pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
71 lines • 4.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_PrivateKEAKeyAttributes = exports._decode_PrivateKEAKeyAttributes = exports._extension_additions_list_spec_for_PrivateKEAKeyAttributes = exports._root_component_type_list_2_spec_for_PrivateKEAKeyAttributes = exports._root_component_type_list_1_spec_for_PrivateKEAKeyAttributes = exports.PrivateKEAKeyAttributes = void 0;
const tslib_1 = require("tslib");
const DomainParameters_ta_1 = require("ansi-x9-42/dist/node/modules/ANSI-X9-42/DomainParameters.ta");
const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional"));
const KEAPrivateKey_ta_1 = require("../PKCS-15/KEAPrivateKey.ta");
const KeyInfo_ta_1 = require("../PKCS-15/KeyInfo.ta");
const ObjectValue_ta_1 = require("../PKCS-15/ObjectValue.ta");
const PublicKeyOperations_ta_1 = require("../PKCS-15/PublicKeyOperations.ta");
class PrivateKEAKeyAttributes {
constructor(value, keyInfo, _unrecognizedExtensionsList = []) {
this.value = value;
this.keyInfo = keyInfo;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
static _from_object(_o) {
return new PrivateKEAKeyAttributes(_o.value, _o.keyInfo, _o._unrecognizedExtensionsList);
}
}
exports.PrivateKEAKeyAttributes = PrivateKEAKeyAttributes;
exports._root_component_type_list_1_spec_for_PrivateKEAKeyAttributes = [
new $.ComponentSpec("value", false, $.hasAnyTag, undefined, undefined),
new $.ComponentSpec("keyInfo", true, $.hasAnyTag, undefined, undefined),
];
exports._root_component_type_list_2_spec_for_PrivateKEAKeyAttributes = [];
exports._extension_additions_list_spec_for_PrivateKEAKeyAttributes = [];
let _cached_decoder_for_PrivateKEAKeyAttributes = null;
function _decode_PrivateKEAKeyAttributes(el) {
if (!_cached_decoder_for_PrivateKEAKeyAttributes) {
_cached_decoder_for_PrivateKEAKeyAttributes = function (el) {
let value;
let keyInfo;
let _unrecognizedExtensionsList = [];
const callbacks = {
value: (_el) => {
value = ObjectValue_ta_1._get_decoder_for_ObjectValue(KEAPrivateKey_ta_1._decode_KEAPrivateKey)(_el);
},
keyInfo: (_el) => {
keyInfo = KeyInfo_ta_1._get_decoder_for_KeyInfo(DomainParameters_ta_1._decode_DomainParameters, PublicKeyOperations_ta_1._decode_PublicKeyOperations)(_el);
},
};
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_PrivateKEAKeyAttributes, exports._extension_additions_list_spec_for_PrivateKEAKeyAttributes, exports._root_component_type_list_2_spec_for_PrivateKEAKeyAttributes, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new PrivateKEAKeyAttributes(value, keyInfo, _unrecognizedExtensionsList);
};
}
return _cached_decoder_for_PrivateKEAKeyAttributes(el);
}
exports._decode_PrivateKEAKeyAttributes = _decode_PrivateKEAKeyAttributes;
let _cached_encoder_for_PrivateKEAKeyAttributes = null;
function _encode_PrivateKEAKeyAttributes(value, elGetter) {
if (!_cached_encoder_for_PrivateKEAKeyAttributes) {
_cached_encoder_for_PrivateKEAKeyAttributes = function (value, elGetter) {
return $._encodeSequence([]
.concat([
ObjectValue_ta_1._get_encoder_for_ObjectValue(KEAPrivateKey_ta_1._encode_KEAPrivateKey)(value.value, $.BER),
value.keyInfo === undefined
? undefined
: KeyInfo_ta_1._get_encoder_for_KeyInfo(DomainParameters_ta_1._encode_DomainParameters, PublicKeyOperations_ta_1._encode_PublicKeyOperations)(value.keyInfo, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_PrivateKEAKeyAttributes(value, elGetter);
}
exports._encode_PrivateKEAKeyAttributes = _encode_PrivateKEAKeyAttributes;
//# sourceMappingURL=PrivateKEAKeyAttributes.ta.js.map