/** * @module node_opcua_crypto */ import { Certificate, PEM, DER } from './common'; import { PublicKeyLength } from './explore_certificate'; import { AlgorithmIdentifier, BlockInfo, DirectoryName, SignatureValue } from './asn1'; 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: Uint8Array; } export declare function readSubjectPublicKeyInfo(buffer: Uint8Array, block: BlockInfo): SubjectPublicKeyInfo; 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?: { [key: string]: string[]; }; } export interface TbsCertificate { version: number; serialNumber: string; issuer: DirectoryName; signature: AlgorithmIdentifier; validity: Validity; subject: DirectoryName; subjectFingerPrint: string; subjectPublicKeyInfo: SubjectPublicKeyInfo; extensions: CertificateExtension | null; } 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): Promise; export declare function getSPKIFromCertificate(certificate: Certificate): Uint8Array; /** * @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; /** * @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[]; export declare function convertPEMtoDER(raw_key: PEM): DER; export declare function generatePublicKeyFromDER(der_certificate: Uint8Array, hash: 'SHA-1' | 'SHA-256'): PromiseLike; export declare function generateVerifyKeyFromDER(der_certificate: Uint8Array, hash: 'SHA-1' | 'SHA-256', algorithm?: 'RSASSA-PKCS1-v1_5' | 'RSA-PSS'): PromiseLike; /** * Import an ECC SPKI when the curve is already known (e.g. from the * SecurityPolicy). No fallback: fails fast on curve mismatch. */ export declare function generateEccVerifyKeyFromDER(der_certificate: Uint8Array, hash: 'SHA-256' | 'SHA-384', namedCurve: 'P-256' | 'P-384'): PromiseLike; /** * generate a RSA private key for decrypting */ export declare function generatePrivateKeyFromDER(der_certificate: Uint8Array, hash: 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512'): Promise; /** * generate an RSA private key for signing */ export declare function generateSignKeyFromDER(der_certificate: Uint8Array, hash: 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512', algorithm?: 'RSASSA-PKCS1-v1_5' | 'RSA-PSS' | 'ECDSA', namedCurve?: 'P-256' | 'P-384'): Promise; //# sourceMappingURL=crypto_explore_certificate.d.ts.map