/** * @module node_opcua_crypto */ /// import { BlockInfo, AlgorithmIdentifier, SignatureValue, DirectoryName } from "./asn1"; import { Certificate } from "./common"; import { PublicKeyLength } from "./explore_certificate"; export interface AttributeTypeAndValue { [key: string]: any; } export interface Validity { notBefore: Date; notAfter: Date; } export interface X509KeyUsage { digitalSignature: boolean; nonRepudiation: boolean; keyEncipherment: boolean; dataEncipherment: boolean; keyAgreement: boolean; keyCertSign: boolean; cRLSign: boolean; encipherOnly: boolean; decipherOnly: boolean; } export interface X509ExtKeyUsage { clientAuth: boolean; serverAuth: boolean; codeSigning: boolean; emailProtection: boolean; timeStamping: boolean; ocspSigning: boolean; ipsecEndSystem: boolean; ipsecTunnel: boolean; ipsecUser: boolean; } export interface SubjectPublicKey { modulus: Buffer; } export declare function _readExtension(buffer: Buffer, block: BlockInfo): { identifier: { oid: string; name: string; }; value: any; }; export interface SubjectPublicKeyInfo { algorithm: string; keyLength: PublicKeyLength; subjectPublicKey: SubjectPublicKey; } export interface BasicConstraints { critical: boolean; cA: boolean; pathLengthConstraint?: number; } export interface AuthorityKeyIdentifier { keyIdentifier: string | null; authorityCertIssuer: DirectoryName | null; authorityCertIssuerFingerPrint: string; serial: string | null; } export interface CertificateExtension { basicConstraints: BasicConstraints; subjectKeyIdentifier?: string; authorityKeyIdentifier?: AuthorityKeyIdentifier; keyUsage?: X509KeyUsage; extKeyUsage?: X509ExtKeyUsage; subjectAltName?: any; } export interface TbsCertificate { version: number; serialNumber: string; issuer: any; signature: AlgorithmIdentifier; validity: Validity; subject: DirectoryName; subjectFingerPrint: string; subjectPublicKeyInfo: SubjectPublicKeyInfo; extensions: CertificateExtension | null; } export declare function readTbsCertificate(buffer: Buffer, block: BlockInfo): TbsCertificate; export interface CertificateInternals { tbsCertificate: TbsCertificate; signatureAlgorithm: AlgorithmIdentifier; signatureValue: SignatureValue; } /** * explore a certificate structure * @param certificate * @returns a json object that exhibits the internal data of the certificate */ export declare function exploreCertificate(certificate: Certificate): CertificateInternals; /** * @method split_der * split a multi chain certificates * @param certificateChain the certificate chain in der (binary) format} * @returns an array of Der , each element of the array is one certificate of the chain */ export declare function split_der(certificateChain: Certificate): Certificate[]; /** * @method combine_der * combine an array of certificates into a single blob * @param certificates a array with the individual DER certificates of the chain * @return a concatenated buffer containing the certificates */ export declare function combine_der(certificates: Certificate[]): Certificate;