@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
173 lines (172 loc) • 5.21 kB
TypeScript
import { OPTIONAL, BIT_STRING, ASN1Element as _Element } from "asn1-ts";
import * as $ from "asn1-ts/dist/node/functional";
import { AlgorithmIdentifier } from "../PKI-Stub/AlgorithmIdentifier.ta";
/**
* @summary SIGNED
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* SIGNED{ToBeSigned} ::= SEQUENCE {
* toBeSigned ToBeSigned,
* algorithmIdentifier AlgorithmIdentifier{{SupportedAlgorithms}},
* signature BIT STRING,
* ...,
* altAlgorithmIdentifier AlgorithmIdentifier{{SupportedAlgorithms}} OPTIONAL,
* altSignature BIT STRING OPTIONAL
* } (WITH COMPONENTS {..., altAlgorithmIdentifier PRESENT, altSignature PRESENT } |
* WITH COMPONENTS {..., altAlgorithmIdentifier ABSENT, altSignature ABSENT } )
* ```
*
* @class
*/
export declare class SIGNED<ToBeSigned> {
/**
* @summary `toBeSigned`.
* @public
* @readonly
*/
readonly toBeSigned: ToBeSigned;
/**
* @summary `algorithmIdentifier`.
* @public
* @readonly
*/
readonly algorithmIdentifier: AlgorithmIdentifier;
/**
* @summary `signature`.
* @public
* @readonly
*/
readonly signature: BIT_STRING;
/**
* @summary `altAlgorithmIdentifier`.
* @public
* @readonly
*/
readonly altAlgorithmIdentifier: OPTIONAL<AlgorithmIdentifier>;
/**
* @summary `altSignature`.
* @public
* @readonly
*/
readonly altSignature: OPTIONAL<BIT_STRING>;
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
readonly _unrecognizedExtensionsList: _Element[];
/**
* @summary The orignal DER encoding of the signed thing (not just the toBeSigned)
* @description
*
* This is the original byte encoding of the signed thing, not just the
* `toBeSigned` part alone. (Instead of preserving just the bytes of
* `toBeSigned`, we preserve all bytes so that the entire certificate can
* be hashed reliably, which is important for some applications.)
*
* This exists so that the original encoding element can be preserved for
* the sake of validating the signature correctly.
*
* @public
*/
originalDER?: Uint8Array;
constructor(
/**
* @summary `toBeSigned`.
* @public
* @readonly
*/
toBeSigned: ToBeSigned,
/**
* @summary `algorithmIdentifier`.
* @public
* @readonly
*/
algorithmIdentifier: AlgorithmIdentifier,
/**
* @summary `signature`.
* @public
* @readonly
*/
signature: BIT_STRING,
/**
* @summary `altAlgorithmIdentifier`.
* @public
* @readonly
*/
altAlgorithmIdentifier: OPTIONAL<AlgorithmIdentifier>,
/**
* @summary `altSignature`.
* @public
* @readonly
*/
altSignature: OPTIONAL<BIT_STRING>,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList?: _Element[],
/**
* @summary
*/
originalDER?: _Element);
/**
* @summary Restructures an object into a SIGNED
* @description
*
* This takes an `object` and converts it to a `SIGNED`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `SIGNED`.
* @returns {SIGNED}
*/
static _from_object(_o: {
[_K in keyof SIGNED<any>]: SIGNED<any>[_K];
}): SIGNED<any>;
}
/**
* @summary The Leading Root Component Types of SIGNED
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the leading root component type list of a SET or SEQUENCE.
*
* @constant
*/
export declare const _root_component_type_list_1_spec_for_SIGNED: $.ComponentSpec[];
/**
* @summary The Trailing Root Component Types of SIGNED
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the trailing root component type list of a SET or SEQUENCE.
*
* @constant
*/
export declare const _root_component_type_list_2_spec_for_SIGNED: $.ComponentSpec[];
/**
* @summary The Extension Addition Component Types of SIGNED
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the extension addition component type list of a SET or SEQUENCE.
*
* @constant
*/
export declare const _extension_additions_list_spec_for_SIGNED: $.ComponentSpec[];
/**
* @summary Returns a function that will decode an ASN.1 element into a(n) SIGNED
* @function
* @param {_Element} el The element being decoded.
* @returns A function that will decode an ASN.1 element.
*/
export declare function _get_decoder_for_SIGNED<ToBeSigned>(_decode_ToBeSigned: $.ASN1Decoder<ToBeSigned>): (el: _Element) => SIGNED<ToBeSigned>;
/**
* @summary Returns a function that will encode a(n) SIGNED into an ASN.1 Element.
* @function
* @returns A function that will encode a(n) SIGNED as an ASN.1 element.
*/
export declare function _get_encoder_for_SIGNED<ToBeSigned>(_encode_ToBeSigned: $.ASN1Encoder<ToBeSigned>): (value: SIGNED<ToBeSigned>, elGetter: $.ASN1Encoder<SIGNED<ToBeSigned>>) => _Element;