pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
75 lines • 4.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_KEKIdentifier = exports._decode_KEKIdentifier = exports._extension_additions_list_spec_for_KEKIdentifier = exports._root_component_type_list_2_spec_for_KEKIdentifier = exports._root_component_type_list_1_spec_for_KEKIdentifier = exports.KEKIdentifier = exports._encode_OtherKeyAttribute = exports._decode_OtherKeyAttribute = exports.OtherKeyAttribute = void 0;
const tslib_1 = require("tslib");
const asn1_ts_1 = require("asn1-ts");
const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional"));
const OtherKeyAttribute_ta_1 = require("../CryptographicMessageSyntax/OtherKeyAttribute.ta");
var OtherKeyAttribute_ta_2 = require("../CryptographicMessageSyntax/OtherKeyAttribute.ta");
Object.defineProperty(exports, "OtherKeyAttribute", { enumerable: true, get: function () { return OtherKeyAttribute_ta_2.OtherKeyAttribute; } });
Object.defineProperty(exports, "_decode_OtherKeyAttribute", { enumerable: true, get: function () { return OtherKeyAttribute_ta_2._decode_OtherKeyAttribute; } });
Object.defineProperty(exports, "_encode_OtherKeyAttribute", { enumerable: true, get: function () { return OtherKeyAttribute_ta_2._encode_OtherKeyAttribute; } });
class KEKIdentifier {
constructor(keyIdentifier, date, other) {
this.keyIdentifier = keyIdentifier;
this.date = date;
this.other = other;
}
static _from_object(_o) {
return new KEKIdentifier(_o.keyIdentifier, _o.date, _o.other);
}
}
exports.KEKIdentifier = KEKIdentifier;
exports._root_component_type_list_1_spec_for_KEKIdentifier = [
new $.ComponentSpec("keyIdentifier", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 4), undefined, undefined),
new $.ComponentSpec("date", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 24), undefined, undefined),
new $.ComponentSpec("other", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined),
];
exports._root_component_type_list_2_spec_for_KEKIdentifier = [];
exports._extension_additions_list_spec_for_KEKIdentifier = [];
let _cached_decoder_for_KEKIdentifier = null;
function _decode_KEKIdentifier(el) {
if (!_cached_decoder_for_KEKIdentifier) {
_cached_decoder_for_KEKIdentifier = function (el) {
let keyIdentifier;
let date;
let other;
const callbacks = {
keyIdentifier: (_el) => {
keyIdentifier = $._decodeOctetString(_el);
},
date: (_el) => {
date = $._decodeGeneralizedTime(_el);
},
other: (_el) => {
other = OtherKeyAttribute_ta_1._decode_OtherKeyAttribute(_el);
},
};
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_KEKIdentifier, exports._extension_additions_list_spec_for_KEKIdentifier, exports._root_component_type_list_2_spec_for_KEKIdentifier, undefined);
return new KEKIdentifier(keyIdentifier, date, other);
};
}
return _cached_decoder_for_KEKIdentifier(el);
}
exports._decode_KEKIdentifier = _decode_KEKIdentifier;
let _cached_encoder_for_KEKIdentifier = null;
function _encode_KEKIdentifier(value, elGetter) {
if (!_cached_encoder_for_KEKIdentifier) {
_cached_encoder_for_KEKIdentifier = function (value, elGetter) {
return $._encodeSequence([]
.concat([
$._encodeOctetString(value.keyIdentifier, $.BER),
value.date === undefined
? undefined
: $._encodeGeneralizedTime(value.date, $.BER),
value.other === undefined
? undefined
: OtherKeyAttribute_ta_1._encode_OtherKeyAttribute(value.other, $.BER),
])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_KEKIdentifier(value, elGetter);
}
exports._encode_KEKIdentifier = _encode_KEKIdentifier;
//# sourceMappingURL=KEKIdentifier.ta.js.map