UNPKG

@universis/common

Version:

Universis - common directives and services

79 lines (78 loc) 2.41 kB
import { X509 } from 'jsrsasign'; import * as i0 from "@angular/core"; export declare class CertificateService { constructor(); /** * * It returns a X509 certificate from the raw certificate sting * * @param {string} certificate The raw user certificate * * @returns {X509} The certificate object in x509 format * */ getX509Certificate(certificate: any): any; /** * * Parses a certificate from a continuous string of chars in a PEM formatted * certificate * * @param {string} certificate The x509 certificate in raw format * * @returns {X509} The certificate object in x509 format * */ formatCertificate(certificate: string): X509; /** * * Splits a string of text in an array of same length characters * * @param {string} payload The string to be split * @param {number} lineLength The number of characters in line * * @returns {Array<string>} The split string parts * */ splitStringToChunks(payload: string, lineLength: number): string[]; /** * * Parses a jsrsasign to a Date object * * @param {string} date The date as is returned form jsrsasign library in UTC 0 * * @returns {Date} The parsed date */ parseCertificateDate(date: string): Date | null; /** * Gets certificate extensions attributes * */ private static getCertificateParams; /** * Extracts key usages from the certificate: * It parses X509 v3 key and extended key usages * and returns an array with the purposes. * @param {X509} certificate */ extractPurposes(certificate: X509): any[]; /** * Creates a map of common keyUsage OIDs * to their name * @return {Map<string,string>} */ private static mapOIDToString; /** * Extract the owner of the certificate: * In an X509 certificate the subject contains * information on the user and the common name * is the name of the user that the certificate * was issued to by the certificate authority. * @param {X509} certificate */ extractCertificateOwner(certificate: X509): { givenName: any; familyName: any; }; static ɵfac: i0.ɵɵFactoryDeclaration<CertificateService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<CertificateService>; }