@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
63 lines • 3.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_CertificateChoices = exports._decode_CertificateChoices = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const AttributeCertificate_ta_1 = require("@wildboar/x500/src/lib/modules/AttributeCertificateDefinitions/AttributeCertificate.ta");
const Certificate_ta_1 = require("@wildboar/x500/src/lib/modules/AuthenticationFramework/Certificate.ta");
const ExtendedCertificate_ta_1 = require("../CryptographicMessageSyntax/ExtendedCertificate.ta");
/* END_OF_SYMBOL_DEFINITION CertificateChoices */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_CertificateChoices */
let _cached_decoder_for_CertificateChoices = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_CertificateChoices */
/* START_OF_SYMBOL_DEFINITION _decode_CertificateChoices */
/**
* @summary Decodes an ASN.1 element into a(n) CertificateChoices
* @function
* @param {_Element} el The element being decoded.
* @returns {CertificateChoices} The decoded data structure.
*/
function _decode_CertificateChoices(el) {
if (!_cached_decoder_for_CertificateChoices) {
_cached_decoder_for_CertificateChoices = $._decode_inextensible_choice({
"UNIVERSAL 16": ["certificate", Certificate_ta_1._decode_Certificate],
"CONTEXT 0": [
"extendedCertificate",
$._decode_implicit(() => ExtendedCertificate_ta_1._decode_ExtendedCertificate),
],
"CONTEXT 1": [
"attrCert",
$._decode_implicit(() => AttributeCertificate_ta_1._decode_AttributeCertificate),
],
});
}
return _cached_decoder_for_CertificateChoices(el);
}
exports._decode_CertificateChoices = _decode_CertificateChoices;
/* END_OF_SYMBOL_DEFINITION _decode_CertificateChoices */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_CertificateChoices */
let _cached_encoder_for_CertificateChoices = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_CertificateChoices */
/* START_OF_SYMBOL_DEFINITION _encode_CertificateChoices */
/**
* @summary Encodes a(n) CertificateChoices 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 CertificateChoices, encoded as an ASN.1 Element.
*/
function _encode_CertificateChoices(value, elGetter) {
if (!_cached_encoder_for_CertificateChoices) {
_cached_encoder_for_CertificateChoices = $._encode_choice({
certificate: Certificate_ta_1._encode_Certificate,
extendedCertificate: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => ExtendedCertificate_ta_1._encode_ExtendedCertificate, $.BER),
attrCert: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => AttributeCertificate_ta_1._encode_AttributeCertificate, $.BER),
}, $.BER);
}
return _cached_encoder_for_CertificateChoices(value, elGetter);
}
exports._encode_CertificateChoices = _encode_CertificateChoices;
/* END_OF_SYMBOL_DEFINITION _encode_CertificateChoices */
/* eslint-enable */
//# sourceMappingURL=CertificateChoices.ta.js.map