UNPKG

@wildboar/pkcs

Version:
142 lines 10.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_SecretKeyType = exports._decode_SecretKeyType = exports._get_encoder_for_SecretKeyObject = exports._get_decoder_for_SecretKeyObject = exports._encode_OtherKey = exports._decode_OtherKey = exports.OtherKey = exports._encode_GenericSecretKeyAttributes = exports._decode_GenericSecretKeyAttributes = exports.GenericSecretKeyAttributes = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const GenericSecretKeyAttributes_ta_1 = require("../PKCS-15/GenericSecretKeyAttributes.ta"); const OtherKey_ta_1 = require("../PKCS-15/OtherKey.ta"); const SecretKeyObject_ta_1 = require("../PKCS-15/SecretKeyObject.ta"); var GenericSecretKeyAttributes_ta_2 = require("../PKCS-15/GenericSecretKeyAttributes.ta"); Object.defineProperty(exports, "GenericSecretKeyAttributes", { enumerable: true, get: function () { return GenericSecretKeyAttributes_ta_2.GenericSecretKeyAttributes; } }); Object.defineProperty(exports, "_decode_GenericSecretKeyAttributes", { enumerable: true, get: function () { return GenericSecretKeyAttributes_ta_2._decode_GenericSecretKeyAttributes; } }); Object.defineProperty(exports, "_encode_GenericSecretKeyAttributes", { enumerable: true, get: function () { return GenericSecretKeyAttributes_ta_2._encode_GenericSecretKeyAttributes; } }); var OtherKey_ta_2 = require("../PKCS-15/OtherKey.ta"); Object.defineProperty(exports, "OtherKey", { enumerable: true, get: function () { return OtherKey_ta_2.OtherKey; } }); Object.defineProperty(exports, "_decode_OtherKey", { enumerable: true, get: function () { return OtherKey_ta_2._decode_OtherKey; } }); Object.defineProperty(exports, "_encode_OtherKey", { enumerable: true, get: function () { return OtherKey_ta_2._encode_OtherKey; } }); var SecretKeyObject_ta_2 = require("../PKCS-15/SecretKeyObject.ta"); Object.defineProperty(exports, "_get_decoder_for_SecretKeyObject", { enumerable: true, get: function () { return SecretKeyObject_ta_2._get_decoder_for_SecretKeyObject; } }); Object.defineProperty(exports, "_get_encoder_for_SecretKeyObject", { enumerable: true, get: function () { return SecretKeyObject_ta_2._get_encoder_for_SecretKeyObject; } }); /* END_OF_SYMBOL_DEFINITION SecretKeyType */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_SecretKeyType */ let _cached_decoder_for_SecretKeyType = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_SecretKeyType */ /* START_OF_SYMBOL_DEFINITION _decode_SecretKeyType */ /** * @summary Decodes an ASN.1 element into a(n) SecretKeyType * @function * @param {_Element} el The element being decoded. * @returns {SecretKeyType} The decoded data structure. */ function _decode_SecretKeyType(el) { if (!_cached_decoder_for_SecretKeyType) { _cached_decoder_for_SecretKeyType = $._decode_extensible_choice({ "UNIVERSAL 16": [ "genericSecretKey", SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes), ], "CONTEXT 0": [ "rc2key", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 1": [ "rc4key", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 2": [ "desKey", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 3": [ "des2Key", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 4": [ "des3Key", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 5": [ "castKey", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 6": [ "cast3Key", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 7": [ "cast128Key", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 8": [ "rc5Key", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 9": [ "ideaKey", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 10": [ "skipjackKey", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 11": [ "batonKey", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 12": [ "juniperKey", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 13": [ "rc6Key", $._decode_implicit(() => SecretKeyObject_ta_1._get_decoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._decode_GenericSecretKeyAttributes)), ], "CONTEXT 14": [ "otherKey", $._decode_implicit(() => OtherKey_ta_1._decode_OtherKey), ], }); } return _cached_decoder_for_SecretKeyType(el); } exports._decode_SecretKeyType = _decode_SecretKeyType; /* END_OF_SYMBOL_DEFINITION _decode_SecretKeyType */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_SecretKeyType */ let _cached_encoder_for_SecretKeyType = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_SecretKeyType */ /* START_OF_SYMBOL_DEFINITION _encode_SecretKeyType */ /** * @summary Encodes a(n) SecretKeyType 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 SecretKeyType, encoded as an ASN.1 Element. */ function _encode_SecretKeyType(value, elGetter) { if (!_cached_encoder_for_SecretKeyType) { _cached_encoder_for_SecretKeyType = $._encode_choice({ genericSecretKey: SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), rc2key: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), rc4key: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), desKey: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 2, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), des2Key: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 3, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), des3Key: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 4, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), castKey: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 5, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), cast3Key: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 6, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), cast128Key: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 7, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), rc5Key: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 8, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), ideaKey: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 9, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), skipjackKey: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 10, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), batonKey: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 11, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), juniperKey: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 12, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), rc6Key: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 13, () => SecretKeyObject_ta_1._get_encoder_for_SecretKeyObject(GenericSecretKeyAttributes_ta_1._encode_GenericSecretKeyAttributes), $.BER), otherKey: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 14, () => OtherKey_ta_1._encode_OtherKey, $.BER), }, $.BER); } return _cached_encoder_for_SecretKeyType(value, elGetter); } exports._encode_SecretKeyType = _encode_SecretKeyType; /* END_OF_SYMBOL_DEFINITION _encode_SecretKeyType */ /* eslint-enable */ //# sourceMappingURL=SecretKeyType.ta.js.map