pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
30 lines • 1.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_ECPublicKeyChoice = exports._decode_ECPublicKeyChoice = void 0;
const tslib_1 = require("tslib");
const ECPoint_ta_1 = require("ansi-x9-62/dist/node/modules/ANSI-X9-62/ECPoint.ta");
const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional"));
const SubjectPublicKeyInfo_ta_1 = require("x500-ts/dist/node/modules/AuthenticationFramework/SubjectPublicKeyInfo.ta");
let _cached_decoder_for_ECPublicKeyChoice = null;
function _decode_ECPublicKeyChoice(el) {
if (!_cached_decoder_for_ECPublicKeyChoice) {
_cached_decoder_for_ECPublicKeyChoice = $._decode_extensible_choice({
"UNIVERSAL 4": ["raw", ECPoint_ta_1._decode_ECPoint],
"UNIVERSAL 16": ["spki", SubjectPublicKeyInfo_ta_1._decode_SubjectPublicKeyInfo],
});
}
return _cached_decoder_for_ECPublicKeyChoice(el);
}
exports._decode_ECPublicKeyChoice = _decode_ECPublicKeyChoice;
let _cached_encoder_for_ECPublicKeyChoice = null;
function _encode_ECPublicKeyChoice(value, elGetter) {
if (!_cached_encoder_for_ECPublicKeyChoice) {
_cached_encoder_for_ECPublicKeyChoice = $._encode_choice({
raw: ECPoint_ta_1._encode_ECPoint,
spki: SubjectPublicKeyInfo_ta_1._encode_SubjectPublicKeyInfo,
}, $.BER);
}
return _cached_encoder_for_ECPublicKeyChoice(value, elGetter);
}
exports._encode_ECPublicKeyChoice = _encode_ECPublicKeyChoice;
//# sourceMappingURL=ECPublicKeyChoice.ta.js.map