/** * The DER the leaf issuer writes and reads: the handful of ASN.1 shapes an * X.509 certificate is made of, encoded minimally, and a walker over a DER * SEQUENCE's content. Minimal encoding is not a nicety here. A verifier in a * workload's runtime may be strict (Go's, Java's and the Rust web-PKI * libraries all refuse a length that is not in its shortest form), so a leaf * that OpenSSL would read and they would not is a leaf that governs Node and * fails Go. Each function encodes one shape and nothing else; the certificate * itself is composed in `LeafIssuer`. */ /** DER that cannot be walked: a length past the end of its container. */ export declare class MalformedDer extends RangeError { constructor(message: string); } /** The length octets for `size` content bytes, in the shortest form DER allows. */ export declare function lengthOctets(size: number): Buffer; /** One element: tag, length, content. */ export declare function element(tag: number, content: Buffer): Buffer; export declare const sequence: (...parts: Buffer[]) => Buffer; export declare const set: (...parts: Buffer[]) => Buffer; export declare const octetString: (bytes: Buffer) => Buffer; export declare const bitString: (bytes: Buffer, unusedBits?: number) => Buffer; export declare const utf8String: (text: string) => Buffer; export declare const ia5String: (text: string) => Buffer; export declare const booleanTrue: Buffer; export declare const asn1Null: Buffer; /** A context-specific, constructed, explicitly tagged element: `[index]`. */ export declare const explicit: (index: number, content: Buffer) => Buffer; /** A context-specific, primitive, implicitly tagged element, such as a GeneralName's dNSName. */ export declare const implicit: (index: number, content: Buffer) => Buffer; /** * A non-negative INTEGER from its big-endian magnitude: a leading zero is * added when the top bit is set, so the value is not read as negative. */ export declare function integer(magnitude: Buffer): Buffer; /** An OBJECT IDENTIFIER from its dotted form. */ export declare function oid(dotted: string): Buffer; /** A UTCTime, `YYMMDDHHMMSSZ`, which X.509 uses for dates before 2050. */ export declare function utcTime(date: Date): Buffer; /** An X.509 Extension: identifier, `critical` only when true (DER omits the default), value. */ export declare function extension(identifier: string, critical: boolean, value: Buffer): Buffer; /** The PEM of `bytes` under `label`, base64 in lines of 64. */ export declare function pem(label: string, bytes: Buffer): string; /** One element as read: its tag, the bytes of the whole element, and of its content. */ export interface Element { readonly tag: number; readonly whole: Buffer; readonly content: Buffer; } /** The elements of a SEQUENCE's (or SET's) content, in order. */ export declare function children(content: Buffer): Element[]; /** * The subject Name of a certificate, as encoded: the element after the * validity in its TBSCertificate, whether or not the version is present. These * are the bytes a leaf's issuer field must repeat exactly for a strict verifier * to chain them; OpenSSL compares names canonically, others compare bytes. */ export declare function subjectNameOf(certificate: Buffer): Buffer; //# sourceMappingURL=Der.d.ts.map