UNPKG

pkijs

Version:

Public Key Infrastructure (PKI) is the basis of how identity and key management is performed on the web today. PKIjs is a pure JavaScript library implementing the formats that are used in PKI applications. It is built on WebCrypto and aspires to make it p

1,437 lines (1,413 loc) 356 kB
/*! * Copyright (c) 2014, GlobalSign * Copyright (c) 2015-2019, Peculiar Ventures * All rights reserved. * * Author 2014-2019, Yury Strozhevsky * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * * Neither the name of the {organization} nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ import * as asn1js from 'asn1js'; import { BitString, OctetString } from 'asn1js'; import * as bs from 'bytestreamjs'; type SchemaType = any; type SchemaNames = { blockName?: string; optional?: boolean; }; interface SchemaCompatible { /** * Converts parsed ASN.1 object into current class * @param schema */ fromSchema(schema: SchemaType): void; /** * Convert current object to asn1js object and set correct values * @returns asn1js object */ toSchema(): SchemaType; toJSON(): any; } interface SchemaConstructor { schema?: SchemaType; } /** * Parameters for schema generation */ interface SchemaParameters<N extends Record<string, any> = object> { names?: SchemaNames & N; } interface PkiObjectParameters { schema?: SchemaType; } interface PkiObjectConstructor<T extends PkiObject = PkiObject> { new (params: PkiObjectParameters): T; CLASS_NAME: string; } declare abstract class PkiObject { /** * Name of the class */ static CLASS_NAME: string; /** * Returns block name * @returns Returns string block name */ static blockName(): string; /** * Creates PKI object from the raw data * @param raw ASN.1 encoded raw data * @returns Initialized and filled current class object */ static fromBER<T extends PkiObject>(this: PkiObjectConstructor<T>, raw: BufferSource): T; /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: string): any; /** * Returns value of pre-defined ASN.1 schema for current class * @param parameters Input parameters for the schema * @returns ASN.1 schema object */ static schema(parameters?: SchemaParameters): SchemaType; get className(): string; /** * Converts parsed ASN.1 object into current class * @param schema ASN.1 schema */ abstract fromSchema(schema: SchemaType): void; /** * Converts current object to ASN.1 object and sets correct values * @param encodeFlag If param equal to `false` then creates schema via decoding stored value. In other case creates schema via assembling from cached parts * @returns ASN.1 object */ abstract toSchema(encodeFlag?: boolean): SchemaType; /** * Converts the class to JSON object * @returns JSON object */ abstract toJSON(): any; toString(encoding?: "hex" | "base64" | "base64url"): string; } declare const TYPE$5 = "type"; declare const VALUE$6 = "value"; interface IGeneralName { /** * value type - from a tagged value (0 for "otherName", 1 for "rfc822Name" etc.) */ type: number; /** * ASN.1 object having GeneralName value (type depends on TYPE value) */ value: any; } type GeneralNameParameters = PkiObjectParameters & Partial<{ type: 1 | 2 | 6; value: string; } | { type: 0 | 3 | 4 | 7 | 8; value: any; }>; interface GeneralNameSchema { names?: { blockName?: string; directoryName?: object; builtInStandardAttributes?: object; otherName?: string; rfc822Name?: string; dNSName?: string; x400Address?: string; ediPartyName?: string; uniformResourceIdentifier?: string; iPAddress?: string; registeredID?: string; }; } interface GeneralNameJson { type: number; value: string; } /** * Represents the GeneralName structure described in [RFC5280](https://datatracker.ietf.org/doc/html/rfc5280) */ declare class GeneralName extends PkiObject implements IGeneralName { static CLASS_NAME: string; type: number; value: any; /** * Initializes a new instance of the {@link GeneralName} class * @param parameters Initialization parameters */ constructor(parameters?: GeneralNameParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof TYPE$5): number; static defaultValues(memberName: typeof VALUE$6): any; /** * Compares values with default values for all class members * @param memberName String name for a class member * @param memberValue Value to compare with default value */ static compareWithDefault(memberName: string, memberValue: any): boolean; /** * @inheritdoc * @asn ASN.1 schema * ```asn * GeneralName ::= Choice { * otherName [0] OtherName, * rfc822Name [1] IA5String, * dNSName [2] IA5String, * x400Address [3] ORAddress, * directoryName [4] value, * ediPartyName [5] EDIPartyName, * uniformResourceIdentifier [6] IA5String, * iPAddress [7] OCTET STRING, * registeredID [8] OBJECT IDENTIFIER } *``` */ static schema(parameters?: GeneralNameSchema): asn1js.Choice; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Constructed | asn1js.IA5String | asn1js.ObjectIdentifier | asn1js.Choice; toJSON(): GeneralNameJson; } declare const ACCESS_METHOD = "accessMethod"; declare const ACCESS_LOCATION = "accessLocation"; interface IAccessDescription { /** * The type and format of the information are specified by the accessMethod field. This profile defines two accessMethod OIDs: id-ad-caIssuers and id-ad-ocsp */ accessMethod: string; /** * The accessLocation field specifies the location of the information */ accessLocation: GeneralName; } type AccessDescriptionParameters = PkiObjectParameters & Partial<IAccessDescription>; /** * JSON representation of {@link AccessDescription} */ interface AccessDescriptionJson { accessMethod: string; accessLocation: GeneralNameJson; } /** * Represents the AccessDescription structure described in [RFC5280](https://datatracker.ietf.org/doc/html/rfc5280) * * The authority information access extension indicates how to access * information and services for the issuer of the certificate in which * the extension appears. Information and services may include on-line * validation services and CA policy data. This extension may be included in * end entity or CA certificates. Conforming CAs MUST mark this * extension as non-critical. */ declare class AccessDescription extends PkiObject implements IAccessDescription { static CLASS_NAME: string; accessMethod: string; accessLocation: GeneralName; /** * Initializes a new instance of the {@link AccessDescription} class * @param parameters Initialization parameters */ constructor(parameters?: AccessDescriptionParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof ACCESS_METHOD): string; static defaultValues(memberName: typeof ACCESS_LOCATION): GeneralName; /** * @inheritdoc * @asn ASN.1 schema * ```asn * AccessDescription ::= SEQUENCE { * accessMethod OBJECT IDENTIFIER, * accessLocation GeneralName } *``` */ static schema(parameters?: SchemaParameters<{ accessMethod?: string; accessLocation?: GeneralNameSchema; }>): asn1js.Sequence; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AccessDescriptionJson; } declare const SECONDS = "seconds"; declare const MILLIS = "millis"; declare const MICROS = "micros"; interface IAccuracy { /** * Seconds */ seconds?: number; /** * Milliseconds */ millis?: number; /** * Microseconds */ micros?: number; } type AccuracyParameters = PkiObjectParameters & Partial<IAccuracy>; type AccuracySchema = SchemaParameters<{ seconds?: string; millis?: string; micros?: string; }>; /** * JSON representation of {@link Accuracy} */ interface AccuracyJson { seconds?: number; millis?: number; micros?: number; } /** * Represents the time deviation around the UTC time contained in GeneralizedTime. Described in [RFC3161](https://www.ietf.org/rfc/rfc3161.txt) */ declare class Accuracy extends PkiObject implements IAccuracy { static CLASS_NAME: string; seconds?: number; millis?: number; micros?: number; /** * Initializes a new instance of the {@link Accuracy} class * @param parameters Initialization parameters */ constructor(parameters?: AccuracyParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof SECONDS): number; static defaultValues(memberName: typeof MILLIS): number; static defaultValues(memberName: typeof MICROS): number; static defaultValues(memberName: string): any; /** * Compare values with default values for all class members * @param memberName String name for a class member * @param memberValue Value to compare with default value */ static compareWithDefault(memberName: typeof SECONDS | typeof MILLIS | typeof MICROS, memberValue: number): boolean; static compareWithDefault(memberName: string, memberValue: any): boolean; /** * @inheritdoc * @asn ASN.1 schema * ```asn * Accuracy ::= SEQUENCE { * seconds INTEGER OPTIONAL, * millis [0] INTEGER (1..999) OPTIONAL, * micros [1] INTEGER (1..999) OPTIONAL } *``` */ static schema(parameters?: AccuracySchema): any; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AccuracyJson; } declare const ALGORITHM_ID = "algorithmId"; declare const ALGORITHM_PARAMS = "algorithmParams"; interface IAlgorithmIdentifier { /** * ObjectIdentifier for algorithm (string representation) */ algorithmId: string; /** * Any algorithm parameters */ algorithmParams?: any; } type AlgorithmIdentifierParameters = PkiObjectParameters & Partial<IAlgorithmIdentifier>; /** * JSON representation of {@link AlgorithmIdentifier} */ interface AlgorithmIdentifierJson { algorithmId: string; algorithmParams?: any; } type AlgorithmIdentifierSchema = SchemaParameters<{ algorithmIdentifier?: string; algorithmParams?: string; }>; /** * Represents the AlgorithmIdentifier structure described in [RFC5280](https://datatracker.ietf.org/doc/html/rfc5280) */ declare class AlgorithmIdentifier extends PkiObject implements IAlgorithmIdentifier { static CLASS_NAME: string; algorithmId: string; algorithmParams?: any; /** * Initializes a new instance of the {@link AlgorithmIdentifier} class * @param parameters Initialization parameters */ constructor(parameters?: AlgorithmIdentifierParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof ALGORITHM_ID): string; static defaultValues(memberName: typeof ALGORITHM_PARAMS): any; /** * Compares values with default values for all class members * @param memberName String name for a class member * @param memberValue Value to compare with default value */ static compareWithDefault(memberName: string, memberValue: any): boolean; /** * @inheritdoc * @asn ASN.1 schema * ```asn * AlgorithmIdentifier ::= Sequence { * algorithm OBJECT IDENTIFIER, * parameters ANY DEFINED BY algorithm OPTIONAL } *``` */ static schema(parameters?: AlgorithmIdentifierSchema): any; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AlgorithmIdentifierJson; /** * Checks that two "AlgorithmIdentifiers" are equal * @param algorithmIdentifier */ isEqual(algorithmIdentifier: unknown): boolean; } declare const ALT_NAMES = "altNames"; interface IAltName { /** * Array of alternative names in GeneralName type */ altNames: GeneralName[]; } type AltNameParameters = PkiObjectParameters & Partial<IAltName>; interface AltNameJson { altNames: GeneralNameJson[]; } /** * Represents the AltName structure described in [RFC5280](https://datatracker.ietf.org/doc/html/rfc5280) */ declare class AltName extends PkiObject implements IAltName { static CLASS_NAME: string; altNames: GeneralName[]; /** * Initializes a new instance of the {@link AltName} class * @param parameters Initialization parameters */ constructor(parameters?: AltNameParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof ALT_NAMES): GeneralName[]; /** * @inheritdoc * @asn ASN.1 schema * ```asn * AltName ::= GeneralNames *``` */ static schema(parameters?: SchemaParameters<{ altNames?: string; }>): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AltNameJson; } declare const TYPE$4 = "type"; declare const VALUES$1 = "values"; interface IAttribute { /** * Specifies type of attribute value */ type: string; /** * List of attribute values */ values: any[]; } type AttributeParameters = PkiObjectParameters & Partial<IAttribute>; type AttributeSchema = SchemaParameters<{ setName?: string; type?: string; values?: string; }>; interface AttributeJson { type: string; values: any[]; } /** * Represents the Attribute structure described in [RFC2986](https://datatracker.ietf.org/doc/html/rfc2986) */ declare class Attribute extends PkiObject implements IAttribute { static CLASS_NAME: string; type: string; values: any[]; /** * Initializes a new instance of the {@link Attribute} class * @param parameters Initialization parameters */ constructor(parameters?: AttributeParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof TYPE$4): string; static defaultValues(memberName: typeof VALUES$1): any[]; /** * Compares values with default values for all class members * @param memberName String name for a class member * @param memberValue Value to compare with default value */ static compareWithDefault(memberName: string, memberValue: any): boolean; /** * @inheritdoc * @asn ASN.1 schema * ```asn * Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE { * type ATTRIBUTE.&id({IOSet}), * values SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{@type}) * } *``` */ static schema(parameters?: AttributeSchema): asn1js.Sequence; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AttributeJson; } declare const NOT_BEFORE_TIME = "notBeforeTime"; declare const NOT_AFTER_TIME = "notAfterTime"; interface IAttCertValidityPeriod { notBeforeTime: Date; notAfterTime: Date; } type AttCertValidityPeriodParameters = PkiObjectParameters & Partial<IAttCertValidityPeriod>; type AttCertValidityPeriodSchema = SchemaParameters<{ notBeforeTime?: string; notAfterTime?: string; }>; interface AttCertValidityPeriodJson { notBeforeTime: Date; notAfterTime: Date; } /** * Represents the AttCertValidityPeriod structure described in [RFC5755 Section 4.1](https://datatracker.ietf.org/doc/html/rfc5755#section-4.1) */ declare class AttCertValidityPeriod extends PkiObject implements IAttCertValidityPeriod { static CLASS_NAME: string; notBeforeTime: Date; notAfterTime: Date; /** * Initializes a new instance of the {@link AttCertValidityPeriod} class * @param parameters Initialization parameters */ constructor(parameters?: AttCertValidityPeriodParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof NOT_BEFORE_TIME): Date; static defaultValues(memberName: typeof NOT_AFTER_TIME): Date; /** * @inheritdoc * @asn ASN.1 schema * ```asn * AttCertValidityPeriod ::= SEQUENCE { * notBeforeTime GeneralizedTime, * notAfterTime GeneralizedTime * } *``` */ static schema(parameters?: AttCertValidityPeriodSchema): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AttCertValidityPeriodJson; } declare const NAMES = "names"; interface IGeneralNames { names: GeneralName[]; } type GeneralNamesParameters = PkiObjectParameters & Partial<IGeneralNames>; type GeneralNamesSchema = SchemaParameters<{ generalNames?: string; }>; interface GeneralNamesJson { names: GeneralNameJson[]; } /** * Represents the GeneralNames structure described in [RFC5280](https://datatracker.ietf.org/doc/html/rfc5280) */ declare class GeneralNames extends PkiObject implements IGeneralNames { static CLASS_NAME: string; /** * Array of "general names" */ names: GeneralName[]; /** * Initializes a new instance of the {@link GeneralNames} class * @param parameters Initialization parameters */ constructor(parameters?: GeneralNamesParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof NAMES): GeneralName[]; /** * @inheritdoc * @asn ASN.1 schema * ```asn * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName * ``` * * @param parameters Input parameters for the schema * @param optional Flag would be element optional or not * @returns ASN.1 schema object */ static schema(parameters?: GeneralNamesSchema, optional?: boolean): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): GeneralNamesJson; } type ExtensionParsedValue = (SchemaCompatible & { parsingError?: string; }) | SchemaType; interface ExtensionValueType { name: string; type: ExtensionValueConstructor; } interface ExtensionValueConstructor { new (params?: { schema: any; }): SchemaCompatible; } declare class ExtensionValueFactory { static types?: Record<string, ExtensionValueType>; private static getItems; static fromBER(id: string, raw: BufferSource): ExtensionParsedValue | null; static find(id: string): ExtensionValueType | null; static register(id: string, name: string, type: ExtensionValueConstructor): void; } declare const EXTN_ID = "extnID"; declare const CRITICAL = "critical"; declare const EXTN_VALUE = "extnValue"; declare const PARSED_VALUE$5 = "parsedValue"; interface IExtension { extnID: string; critical: boolean; extnValue: asn1js.OctetString; parsedValue?: ExtensionParsedValue; } interface ExtensionConstructorParameters { extnID?: string; critical?: boolean; extnValue?: ArrayBuffer; parsedValue?: ExtensionParsedValue; } type ExtensionParameters = PkiObjectParameters & ExtensionConstructorParameters; type ExtensionSchema = SchemaParameters<{ extnID?: string; critical?: string; extnValue?: string; }>; interface ExtensionJson { extnID: string; extnValue: asn1js.OctetStringJson; critical?: boolean; parsedValue?: any; } /** * Represents the Extension structure described in [RFC5280](https://datatracker.ietf.org/doc/html/rfc5280) */ declare class Extension extends PkiObject implements IExtension { static CLASS_NAME: string; extnID: string; critical: boolean; extnValue: asn1js.OctetString; private _parsedValue?; get parsedValue(): ExtensionParsedValue | undefined; set parsedValue(value: ExtensionParsedValue | undefined); /** * Initializes a new instance of the {@link Extension} class * @param parameters Initialization parameters */ constructor(parameters?: ExtensionParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof EXTN_ID): string; static defaultValues(memberName: typeof CRITICAL): boolean; static defaultValues(memberName: typeof EXTN_VALUE): asn1js.OctetString; static defaultValues(memberName: typeof PARSED_VALUE$5): ExtensionParsedValue; /** * @inheritdoc * @asn ASN.1 schema * ```asn * Extension ::= SEQUENCE { * extnID OBJECT IDENTIFIER, * critical BOOLEAN DEFAULT FALSE, * extnValue OCTET STRING * } *``` */ static schema(parameters?: ExtensionSchema): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): ExtensionJson; } declare const EXTENSIONS$6 = "extensions"; interface IExtensions { /** * List of extensions */ extensions: Extension[]; } type ExtensionsParameters = PkiObjectParameters & Partial<IExtensions>; type ExtensionsSchema = SchemaParameters<{ extensions?: string; extension?: ExtensionSchema; }>; interface ExtensionsJson { extensions: ExtensionJson[]; } /** * Represents the Extensions structure described in [RFC5280](https://datatracker.ietf.org/doc/html/rfc5280) */ declare class Extensions extends PkiObject implements IExtensions { static CLASS_NAME: string; extensions: Extension[]; /** * Initializes a new instance of the {@link Extensions} class * @param parameters Initialization parameters */ constructor(parameters?: ExtensionsParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof EXTENSIONS$6): Extension[]; /** * @inheritdoc * @asn ASN.1 schema * ```asn * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension * ``` * * @param parameters Input parameters for the schema * @param optional Flag that current schema should be optional * @returns ASN.1 schema object */ static schema(parameters?: ExtensionsSchema, optional?: boolean): asn1js.Sequence; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): ExtensionsJson; } declare const ISSUER$5 = "issuer"; declare const SERIAL_NUMBER$6 = "serialNumber"; declare const ISSUER_UID = "issuerUID"; interface IIssuerSerial { /** * Issuer name */ issuer: GeneralNames; /** * Serial number */ serialNumber: asn1js.Integer; /** * Issuer unique identifier */ issuerUID?: asn1js.BitString; } type IssuerSerialParameters = PkiObjectParameters & Partial<IIssuerSerial>; interface IssuerSerialJson { issuer: GeneralNamesJson; serialNumber: asn1js.IntegerJson; issuerUID?: asn1js.BitStringJson; } /** * Represents the IssuerSerial structure described in [RFC5755](https://datatracker.ietf.org/doc/html/rfc5755) */ declare class IssuerSerial extends PkiObject implements IIssuerSerial { static CLASS_NAME: string; issuer: GeneralNames; serialNumber: asn1js.Integer; issuerUID?: asn1js.BitString; /** * Initializes a new instance of the {@link IssuerSerial} class * @param parameters Initialization parameters */ constructor(parameters?: IssuerSerialParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof ISSUER$5): GeneralNames; static defaultValues(memberName: typeof SERIAL_NUMBER$6): asn1js.Integer; static defaultValues(memberName: typeof ISSUER_UID): asn1js.BitString; /** * @inheritdoc * @asn ASN.1 schema * ```asn * IssuerSerial ::= SEQUENCE { * issuer GeneralNames, * serial CertificateSerialNumber, * issuerUID UniqueIdentifier OPTIONAL * } * * CertificateSerialNumber ::= INTEGER * UniqueIdentifier ::= BIT STRING *``` */ static schema(parameters?: SchemaParameters<{ issuer?: GeneralNamesSchema; serialNumber?: string; issuerUID?: string; }>): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): IssuerSerialJson; } declare const VERSION$k = "version"; declare const BASE_CERTIFICATE_ID$2 = "baseCertificateID"; declare const SUBJECT_NAME = "subjectName"; declare const ISSUER$4 = "issuer"; declare const SIGNATURE$7 = "signature"; declare const SERIAL_NUMBER$5 = "serialNumber"; declare const ATTR_CERT_VALIDITY_PERIOD$1 = "attrCertValidityPeriod"; declare const ATTRIBUTES$4 = "attributes"; declare const ISSUER_UNIQUE_ID$2 = "issuerUniqueID"; declare const EXTENSIONS$5 = "extensions"; interface IAttributeCertificateInfoV1 { /** * The version field MUST have the value of v2 */ version: number; baseCertificateID?: IssuerSerial; subjectName?: GeneralNames; issuer: GeneralNames; /** * Contains the algorithm identifier used to validate the AC signature */ signature: AlgorithmIdentifier; serialNumber: asn1js.Integer; /** * Specifies the period for which the AC issuer certifies that the binding between * the holder and the attributes fields will be valid */ attrCertValidityPeriod: AttCertValidityPeriod; /** * The attributes field gives information about the AC holder */ attributes: Attribute[]; /** * Issuer unique identifier */ issuerUniqueID?: asn1js.BitString; /** * The extensions field generally gives information about the AC as opposed * to information about the AC holder */ extensions?: Extensions; } interface AttributeCertificateInfoV1Json { version: number; baseCertificateID?: IssuerSerialJson; subjectName?: GeneralNamesJson; issuer: GeneralNamesJson; signature: AlgorithmIdentifierJson; serialNumber: asn1js.IntegerJson; attrCertValidityPeriod: AttCertValidityPeriodJson; attributes: AttributeJson[]; issuerUniqueID: asn1js.BitStringJson; extensions: ExtensionsJson; } type AttributeCertificateInfoV1Parameters = PkiObjectParameters & Partial<IAttributeCertificateInfoV1>; type AttributeCertificateInfoV1Schema = SchemaParameters<{ version?: string; baseCertificateID?: string; subjectName?: string; signature?: AlgorithmIdentifierSchema; issuer?: string; attrCertValidityPeriod?: AttCertValidityPeriodSchema; serialNumber?: string; attributes?: string; issuerUniqueID?: string; extensions?: ExtensionsSchema; }>; /** * Represents the AttributeCertificateInfoV1 structure described in [RFC5755](https://datatracker.ietf.org/doc/html/rfc5755) */ declare class AttributeCertificateInfoV1 extends PkiObject implements IAttributeCertificateInfoV1 { static CLASS_NAME: string; version: number; baseCertificateID?: IssuerSerial; subjectName?: GeneralNames; issuer: GeneralNames; signature: AlgorithmIdentifier; serialNumber: asn1js.Integer; attrCertValidityPeriod: AttCertValidityPeriod; attributes: Attribute[]; issuerUniqueID?: asn1js.BitString; extensions?: Extensions; /** * Initializes a new instance of the {@link AttributeCertificateInfoV1} class * @param parameters Initialization parameters */ constructor(parameters?: AttributeCertificateInfoV1Parameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof VERSION$k): number; static defaultValues(memberName: typeof BASE_CERTIFICATE_ID$2): IssuerSerial; static defaultValues(memberName: typeof SUBJECT_NAME): GeneralNames; static defaultValues(memberName: typeof ISSUER$4): GeneralNames; static defaultValues(memberName: typeof SIGNATURE$7): AlgorithmIdentifier; static defaultValues(memberName: typeof SERIAL_NUMBER$5): asn1js.Integer; static defaultValues(memberName: typeof ATTR_CERT_VALIDITY_PERIOD$1): AttCertValidityPeriod; static defaultValues(memberName: typeof ATTRIBUTES$4): Attribute[]; static defaultValues(memberName: typeof ISSUER_UNIQUE_ID$2): asn1js.BitString; static defaultValues(memberName: typeof EXTENSIONS$5): Extensions; /** * @inheritdoc * @asn ASN.1 schema * ```asn * AttributeCertificateInfo ::= SEQUENCE { * version Version DEFAULT v1, * subject CHOICE { * baseCertificateID [0] IssuerSerial, -- associated with a Public Key Certificate * subjectName [1] GeneralNames }, -- associated with a name * issuer GeneralNames, -- CA issuing the attribute certificate * signature AlgorithmIdentifier, * serialNumber CertificateSerialNumber, * attrCertValidityPeriod AttCertValidityPeriod, * attributes SEQUENCE OF Attribute, * issuerUniqueID UniqueIdentifier OPTIONAL, * extensions Extensions OPTIONAL * } *``` */ static schema(parameters?: AttributeCertificateInfoV1Schema): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AttributeCertificateInfoV1Json; } declare const ACINFO$1 = "acinfo"; declare const SIGNATURE_ALGORITHM$8 = "signatureAlgorithm"; declare const SIGNATURE_VALUE$4 = "signatureValue"; interface IAttributeCertificateV1 { /** * Attribute certificate information */ acinfo: AttributeCertificateInfoV1; /** * Signature algorithm */ signatureAlgorithm: AlgorithmIdentifier; /** * Signature value */ signatureValue: asn1js.BitString; } interface AttributeCertificateV1Json { acinfo: AttributeCertificateInfoV1Json; signatureAlgorithm: AlgorithmIdentifierJson; signatureValue: asn1js.BitStringJson; } type AttributeCertificateV1Parameters = PkiObjectParameters & Partial<IAttributeCertificateV1>; /** * Class from X.509:1997 */ declare class AttributeCertificateV1 extends PkiObject implements IAttributeCertificateV1 { static CLASS_NAME: string; acinfo: AttributeCertificateInfoV1; signatureAlgorithm: AlgorithmIdentifier; signatureValue: asn1js.BitString; /** * Initializes a new instance of the {@link AttributeCertificateV1} class * @param parameters Initialization parameters */ constructor(parameters?: AttributeCertificateV1Parameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof ACINFO$1): AttributeCertificateInfoV1; static defaultValues(memberName: typeof SIGNATURE_ALGORITHM$8): AlgorithmIdentifier; static defaultValues(memberName: typeof SIGNATURE_VALUE$4): asn1js.BitString; /** * @inheritdoc * @asn ASN.1 schema * ```asn * AttributeCertificate ::= SEQUENCE { * acinfo AttributeCertificateInfoV1, * signatureAlgorithm AlgorithmIdentifier, * signatureValue BIT STRING * } *``` */ static schema(parameters?: SchemaParameters<{ acinfo?: AttributeCertificateInfoV1Schema; signatureAlgorithm?: AlgorithmIdentifierSchema; signatureValue?: string; }>): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AttributeCertificateV1Json; } declare const DIGESTED_OBJECT_TYPE = "digestedObjectType"; declare const OTHER_OBJECT_TYPE_ID = "otherObjectTypeID"; declare const DIGEST_ALGORITHM$2 = "digestAlgorithm"; declare const OBJECT_DIGEST = "objectDigest"; interface IObjectDigestInfo { digestedObjectType: asn1js.Enumerated; otherObjectTypeID?: asn1js.ObjectIdentifier; digestAlgorithm: AlgorithmIdentifier; objectDigest: asn1js.BitString; } type ObjectDigestInfoParameters = PkiObjectParameters & Partial<IObjectDigestInfo>; interface ObjectDigestInfoJson { digestedObjectType: asn1js.EnumeratedJson; otherObjectTypeID?: asn1js.ObjectIdentifierJson; digestAlgorithm: AlgorithmIdentifierJson; objectDigest: asn1js.BitStringJson; } /** * Represents the ObjectDigestInfo structure described in [RFC5755](https://datatracker.ietf.org/doc/html/rfc5755) */ declare class ObjectDigestInfo extends PkiObject implements IObjectDigestInfo { static CLASS_NAME: string; digestedObjectType: asn1js.Enumerated; otherObjectTypeID?: asn1js.ObjectIdentifier; digestAlgorithm: AlgorithmIdentifier; objectDigest: asn1js.BitString; /** * Initializes a new instance of the {@link ObjectDigestInfo} class * @param parameters Initialization parameters */ constructor(parameters?: ObjectDigestInfoParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof DIGESTED_OBJECT_TYPE): asn1js.Enumerated; static defaultValues(memberName: typeof OTHER_OBJECT_TYPE_ID): asn1js.ObjectIdentifier; static defaultValues(memberName: typeof DIGEST_ALGORITHM$2): AlgorithmIdentifier; static defaultValues(memberName: typeof OBJECT_DIGEST): asn1js.BitString; /** * @inheritdoc * @asn ASN.1 schema * ```asn * ObjectDigestInfo ::= SEQUENCE { * digestedObjectType ENUMERATED { * publicKey (0), * publicKeyCert (1), * otherObjectTypes (2) }, * -- otherObjectTypes MUST NOT * -- be used in this profile * otherObjectTypeID OBJECT IDENTIFIER OPTIONAL, * digestAlgorithm AlgorithmIdentifier, * objectDigest BIT STRING * } *``` */ static schema(parameters?: SchemaParameters<{ digestedObjectType?: string; otherObjectTypeID?: string; digestAlgorithm?: AlgorithmIdentifierSchema; objectDigest?: string; }>): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): ObjectDigestInfoJson; } declare const ISSUER_NAME = "issuerName"; declare const BASE_CERTIFICATE_ID$1 = "baseCertificateID"; declare const OBJECT_DIGEST_INFO$1 = "objectDigestInfo"; interface IV2Form { issuerName?: GeneralNames; baseCertificateID?: IssuerSerial; objectDigestInfo?: ObjectDigestInfo; } type V2FormParameters = PkiObjectParameters & Partial<IV2Form>; interface V2FormJson { issuerName?: GeneralNamesJson; baseCertificateID?: IssuerSerialJson; objectDigestInfo?: ObjectDigestInfoJson; } /** * Represents the V2Form structure described in [RFC5755](https://datatracker.ietf.org/doc/html/rfc5755) */ declare class V2Form extends PkiObject implements IV2Form { static CLASS_NAME: string; issuerName?: GeneralNames; baseCertificateID?: IssuerSerial; objectDigestInfo?: ObjectDigestInfo; /** * Initializes a new instance of the {@link V2Form} class * @param parameters Initialization parameters */ constructor(parameters?: V2FormParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof ISSUER_NAME): GeneralNames; static defaultValues(memberName: typeof BASE_CERTIFICATE_ID$1): IssuerSerial; static defaultValues(memberName: typeof OBJECT_DIGEST_INFO$1): ObjectDigestInfo; /** * @inheritdoc * @asn ASN.1 schema * ```asn * V2Form ::= SEQUENCE { * issuerName GeneralNames OPTIONAL, * baseCertificateID [0] IssuerSerial OPTIONAL, * objectDigestInfo [1] ObjectDigestInfo OPTIONAL * -- issuerName MUST be present in this profile * -- baseCertificateID and objectDigestInfo MUST NOT * -- be present in this profile * } *``` */ static schema(parameters?: SchemaParameters<{ issuerName?: string; baseCertificateID?: string; objectDigestInfo?: string; }>): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): V2FormJson; } declare const BASE_CERTIFICATE_ID = "baseCertificateID"; declare const ENTITY_NAME = "entityName"; declare const OBJECT_DIGEST_INFO = "objectDigestInfo"; interface IHolder { baseCertificateID?: IssuerSerial; entityName?: GeneralNames; objectDigestInfo?: ObjectDigestInfo; } type HolderParameters = PkiObjectParameters & Partial<IHolder>; type HolderSchema = SchemaParameters<{ baseCertificateID?: string; entityName?: string; objectDigestInfo?: string; }>; interface HolderJson { baseCertificateID?: IssuerSerialJson; entityName?: GeneralNamesJson; objectDigestInfo?: ObjectDigestInfoJson; } /** * Represents the Holder structure described in [RFC5755](https://datatracker.ietf.org/doc/html/rfc5755) */ declare class Holder extends PkiObject implements IHolder { static CLASS_NAME: string; baseCertificateID?: IssuerSerial; entityName?: GeneralNames; objectDigestInfo?: ObjectDigestInfo; /** * Initializes a new instance of the {@link AttributeCertificateInfoV1} class * @param parameters Initialization parameters */ constructor(parameters?: HolderParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof BASE_CERTIFICATE_ID): IssuerSerial; static defaultValues(memberName: typeof ENTITY_NAME): GeneralNames; static defaultValues(memberName: typeof OBJECT_DIGEST_INFO): ObjectDigestInfo; /** * @inheritdoc * @asn ASN.1 schema * ```asn * Holder ::= SEQUENCE { * baseCertificateID [0] IssuerSerial OPTIONAL, * -- the issuer and serial number of * -- the holder's Public Key Certificate * entityName [1] GeneralNames OPTIONAL, * -- the name of the claimant or role * objectDigestInfo [2] ObjectDigestInfo OPTIONAL * -- used to directly authenticate the holder, * -- for example, an executable * } *``` */ static schema(parameters?: HolderSchema): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): HolderJson; } declare const VERSION$j = "version"; declare const HOLDER = "holder"; declare const ISSUER$3 = "issuer"; declare const SIGNATURE$6 = "signature"; declare const SERIAL_NUMBER$4 = "serialNumber"; declare const ATTR_CERT_VALIDITY_PERIOD = "attrCertValidityPeriod"; declare const ATTRIBUTES$3 = "attributes"; declare const ISSUER_UNIQUE_ID$1 = "issuerUniqueID"; declare const EXTENSIONS$4 = "extensions"; interface IAttributeCertificateInfoV2 { version: number; holder: Holder; issuer: GeneralNames | V2Form; signature: AlgorithmIdentifier; serialNumber: asn1js.Integer; attrCertValidityPeriod: AttCertValidityPeriod; attributes: Attribute[]; issuerUniqueID?: asn1js.BitString; extensions?: Extensions; } type AttributeCertificateInfoV2Parameters = PkiObjectParameters & Partial<AttributeCertificateInfoV2>; type AttributeCertificateInfoV2Schema = SchemaParameters<{ version?: string; holder?: HolderSchema; issuer?: string; signature?: AlgorithmIdentifierSchema; serialNumber?: string; attrCertValidityPeriod?: AttCertValidityPeriodSchema; attributes?: string; issuerUniqueID?: string; extensions?: ExtensionsSchema; }>; interface AttributeCertificateInfoV2Json { version: number; holder: HolderJson; issuer: GeneralNamesJson | V2FormJson; signature: AlgorithmIdentifierJson; serialNumber: asn1js.IntegerJson; attrCertValidityPeriod: AttCertValidityPeriodJson; attributes: AttributeJson[]; issuerUniqueID?: asn1js.BitStringJson; extensions?: ExtensionsJson; } /** * Represents the AttributeCertificateInfoV2 structure described in [RFC5755](https://datatracker.ietf.org/doc/html/rfc5755) */ declare class AttributeCertificateInfoV2 extends PkiObject implements IAttributeCertificateInfoV2 { static CLASS_NAME: string; version: number; holder: Holder; issuer: GeneralNames | V2Form; signature: AlgorithmIdentifier; serialNumber: asn1js.Integer; attrCertValidityPeriod: AttCertValidityPeriod; attributes: Attribute[]; issuerUniqueID?: asn1js.BitString; extensions?: Extensions; /** * Initializes a new instance of the {@link AttributeCertificateInfoV2} class * @param parameters Initialization parameters */ constructor(parameters?: AttributeCertificateInfoV2Parameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof VERSION$j): number; static defaultValues(memberName: typeof HOLDER): Holder; static defaultValues(memberName: typeof ISSUER$3): GeneralNames | V2Form; static defaultValues(memberName: typeof SIGNATURE$6): AlgorithmIdentifier; static defaultValues(memberName: typeof SERIAL_NUMBER$4): asn1js.Integer; static defaultValues(memberName: typeof ATTR_CERT_VALIDITY_PERIOD): AttCertValidityPeriod; static defaultValues(memberName: typeof ATTRIBUTES$3): Attribute[]; static defaultValues(memberName: typeof ISSUER_UNIQUE_ID$1): asn1js.BitString; static defaultValues(memberName: typeof EXTENSIONS$4): Extensions; /** * @inheritdoc * @asn ASN.1 schema * ```asn * AttributeCertificateInfoV2 ::= SEQUENCE { * version AttCertVersion, -- version is v2 * holder Holder, * issuer AttCertIssuer, * signature AlgorithmIdentifier, * serialNumber CertificateSerialNumber, * attrCertValidityPeriod AttCertValidityPeriod, * attributes SEQUENCE OF Attribute, * issuerUniqueID UniqueIdentifier OPTIONAL, * extensions Extensions OPTIONAL * } *``` */ static schema(parameters?: AttributeCertificateInfoV2Schema): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AttributeCertificateInfoV2Json; } declare const ACINFO = "acinfo"; declare const SIGNATURE_ALGORITHM$7 = "signatureAlgorithm"; declare const SIGNATURE_VALUE$3 = "signatureValue"; interface IAttributeCertificateV2 { /** * Attribute certificate information */ acinfo: AttributeCertificateInfoV2; /** * Signature algorithm */ signatureAlgorithm: AlgorithmIdentifier; /** * Signature value */ signatureValue: asn1js.BitString; } type AttributeCertificateV2Parameters = PkiObjectParameters & Partial<IAttributeCertificateV2>; interface AttributeCertificateV2Json { acinfo: AttributeCertificateInfoV2Json; signatureAlgorithm: AlgorithmIdentifierJson; signatureValue: asn1js.BitStringJson; } /** * Represents the AttributeCertificateV2 structure described in [RFC5755](https://datatracker.ietf.org/doc/html/rfc5755) */ declare class AttributeCertificateV2 extends PkiObject implements IAttributeCertificateV2 { static CLASS_NAME: string; acinfo: AttributeCertificateInfoV2; signatureAlgorithm: AlgorithmIdentifier; signatureValue: asn1js.BitString; /** * Initializes a new instance of the {@link AttributeCertificateV2} class * @param parameters Initialization parameters */ constructor(parameters?: AttributeCertificateV2Parameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof ACINFO): AttributeCertificateInfoV2; static defaultValues(memberName: typeof SIGNATURE_ALGORITHM$7): AlgorithmIdentifier; static defaultValues(memberName: typeof SIGNATURE_VALUE$3): asn1js.BitString; /** * @inheritdoc * @asn ASN.1 schema * ```asn * AttributeCertificate ::= SEQUENCE { * acinfo AttributeCertificateInfoV2, * signatureAlgorithm AlgorithmIdentifier, * signatureValue BIT STRING * } *``` */ static schema(parameters?: SchemaParameters<{ acinfo?: AttributeCertificateInfoV2Schema; signatureAlgorithm?: AlgorithmIdentifierSchema; signatureValue?: string; }>): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AttributeCertificateV2Json; } declare const TYPE$3 = "type"; declare const VALUE$5 = "value"; interface IAttributeTypeAndValue { type: string; value: AttributeValueType; } type AttributeTypeAndValueParameters = PkiObjectParameters & Partial<IAttributeTypeAndValue>; type AttributeValueType = asn1js.Utf8String | asn1js.BmpString | asn1js.UniversalString | asn1js.NumericString | asn1js.PrintableString | asn1js.TeletexString | asn1js.VideotexString | asn1js.IA5String | asn1js.GraphicString | asn1js.VisibleString | asn1js.GeneralString | asn1js.CharacterString; interface AttributeTypeAndValueJson { type: string; value: any; } /** * Represents the AttributeTypeAndValue structure described in [RFC5280](https://datatracker.ietf.org/doc/html/rfc5280) */ declare class AttributeTypeAndValue extends PkiObject implements IAttributeTypeAndValue { static CLASS_NAME: string; type: string; value: AttributeValueType; /** * Initializes a new instance of the {@link AttributeTypeAndValue} class * @param parameters Initialization parameters */ constructor(parameters?: AttributeTypeAndValueParameters); /** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value */ static defaultValues(memberName: typeof TYPE$3): string; static defaultValues(memberName: typeof VALUE$5): AttributeValueType; /** * @inheritdoc * @asn ASN.1 schema * ```asn * AttributeTypeAndValue ::= Sequence { * type AttributeType, * value AttributeValue } * * AttributeType ::= OBJECT IDENTIFIER * * AttributeValue ::= ANY -- DEFINED BY AttributeType *``` */ static schema(parameters?: SchemaParameters<{ type?: string; value?: string; }>): SchemaType; fromSchema(schema: SchemaType): void; toSchema(): asn1js.Sequence; toJSON(): AttributeTypeAndValueJson; /** * Compares two AttributeTypeAndValue values, or AttributeTypeAndValue with ArrayBuffer value * @param compareTo The value compare to current */ isEqual(compareTo: AttributeTypeAndValue | ArrayBuffer): boolean; } declare const CONTENT_TYPE$1 = "contentType"; declare const CONTENT = "content"; interface IContentInfo { contentType: string; content: any; } type ContentInfoParameters = PkiObjectParameters & Partial<IContentInfo>; type ContentInfoSchema