@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
55 lines • 2.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_CountryName = exports._decode_CountryName = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
/* END_OF_SYMBOL_DEFINITION CountryName */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_CountryName */
let _cached_decoder_for_CountryName = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_CountryName */
/* START_OF_SYMBOL_DEFINITION _decode_CountryName */
/**
* @summary Decodes an ASN.1 element into a(n) CountryName
* @function
* @param {_Element} el The element being decoded.
* @returns {CountryName} The decoded data structure.
*/
function _decode_CountryName(el) {
if (!_cached_decoder_for_CountryName) {
_cached_decoder_for_CountryName = $._decode_explicit(() => $._decode_inextensible_choice({
"UNIVERSAL 18": ["x121_dcc_code", $._decodeNumericString],
"UNIVERSAL 19": [
"iso_3166_alpha2_code",
$._decodePrintableString,
],
}));
}
return _cached_decoder_for_CountryName(el);
}
exports._decode_CountryName = _decode_CountryName;
/* END_OF_SYMBOL_DEFINITION _decode_CountryName */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_CountryName */
let _cached_encoder_for_CountryName = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_CountryName */
/* START_OF_SYMBOL_DEFINITION _encode_CountryName */
/**
* @summary Encodes a(n) CountryName 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 CountryName, encoded as an ASN.1 Element.
*/
function _encode_CountryName(value, elGetter) {
if (!_cached_encoder_for_CountryName) {
_cached_encoder_for_CountryName = $._encode_explicit(asn1_ts_1.ASN1TagClass.application, 1, () => $._encode_choice({
x121_dcc_code: $._encodeNumericString,
iso_3166_alpha2_code: $._encodePrintableString,
}, $.BER), $.BER);
}
return _cached_encoder_for_CountryName(value, elGetter);
}
exports._encode_CountryName = _encode_CountryName;
/* END_OF_SYMBOL_DEFINITION _encode_CountryName */
/* eslint-enable */
//# sourceMappingURL=CountryName.ta.js.map