UNPKG

@wildboar/pki-stub

Version:
41 lines (40 loc) 1.56 kB
/* eslint-disable */ import { ASN1TagClass as _TagClass, } from "@wildboar/asn1"; import * as $ from "@wildboar/asn1/functional"; let _cached_decoder_for_CountryName = null; /** * @summary Decodes an ASN.1 element into a(n) CountryName * @function * @param {_Element} el The element being decoded. * @returns {CountryName} The decoded data structure. */ export 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); } let _cached_encoder_for_CountryName = null; /** * @summary Encodes a(n) CountryName into an ASN.1 Element. * @function * @param value The element being encoded. * @param elGetter A function that can be used to get new ASN.1 elements. * @returns {_Element} The CountryName, encoded as an ASN.1 Element. */ export function _encode_CountryName(value, elGetter) { if (!_cached_encoder_for_CountryName) { _cached_encoder_for_CountryName = $._encode_explicit(_TagClass.application, 1, () => $._encode_choice({ x121_dcc_code: $._encodeNumericString, iso_3166_alpha2_code: $._encodePrintableString, }, $.BER), $.BER); } return _cached_encoder_for_CountryName(value, elGetter); } /* eslint-enable */