UNPKG

@wildboar/pkcs

Version:
49 lines (48 loc) 1.9 kB
/** * These symbols are imported to override incorrect or obsolete definitions * provided in the ITU X.420 specification of PKCS #7. For example, `Digest` * has a more complicated type defined within ITU X.420, but in the * authoritative IETF RFC definition, `Digest` is simply an `OCTET STRING`. * This overriding is important, because OpenSSL will fail to read PKCS #7 * structures that use the X.420-based `Digest` definition, for example. */ export { Digest, _decode_Digest, _encode_Digest, } from "@wildboar/cms/src/lib/modules/CryptographicMessageSyntax-2010/Digest.ta"; import { ASN1Element, ASN1Element as _Element } from "asn1-ts"; import * as $ from "asn1-ts/dist/node/functional"; import { HASH } from "@wildboar/x500/src/lib/modules/AuthenticationFramework/HASH.ta"; import { Attributes } from "../PKCS7/Attributes.ta"; declare type ToBeHashed = { content: _Element; } | { authenticated_attributes: Attributes; }; /** * @summary Digest * @description * * ### ASN.1 Definition: * * ```asn1 * Digest ::= * HASH * {CHOICE {content * [1] PKCS7-CONTENT-TYPE.&Type({PKCS7ContentTable}), * authenticated-attributes [0] EXPLICIT Attributes}} * ``` */ export declare type X420Digest = HASH<ToBeHashed>; /** * @summary Decodes an ASN.1 element into a(n) Digest * @function * @param {_Element} el The element being decoded. * @returns {Digest} The decoded data structure. */ export declare function _decode_X420Digest(el: _Element): X420Digest; /** * @summary Encodes a(n) Digest into an ASN.1 Element. * @function * @param {value} el The element being decoded. * @param elGetter A function that can be used to get new ASN.1 elements. * @returns {_Element} The Digest, encoded as an ASN.1 Element. */ export declare function _encode_X420Digest(value: X420Digest, elGetter: $.ASN1Encoder<X420Digest>): ASN1Element;