pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
60 lines • 3.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_CommonSecretKeyAttributes = exports._decode_CommonSecretKeyAttributes = exports._extension_additions_list_spec_for_CommonSecretKeyAttributes = exports._root_component_type_list_2_spec_for_CommonSecretKeyAttributes = exports._root_component_type_list_1_spec_for_CommonSecretKeyAttributes = exports.CommonSecretKeyAttributes = void 0;
const tslib_1 = require("tslib");
const asn1_ts_1 = require("asn1-ts");
const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional"));
class CommonSecretKeyAttributes {
constructor(keyLen, _unrecognizedExtensionsList = []) {
this.keyLen = keyLen;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
static _from_object(_o) {
return new CommonSecretKeyAttributes(_o.keyLen, _o._unrecognizedExtensionsList);
}
}
exports.CommonSecretKeyAttributes = CommonSecretKeyAttributes;
exports._root_component_type_list_1_spec_for_CommonSecretKeyAttributes = [
new $.ComponentSpec("keyLen", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 2), undefined, undefined),
];
exports._root_component_type_list_2_spec_for_CommonSecretKeyAttributes = [];
exports._extension_additions_list_spec_for_CommonSecretKeyAttributes = [];
let _cached_decoder_for_CommonSecretKeyAttributes = null;
function _decode_CommonSecretKeyAttributes(el) {
if (!_cached_decoder_for_CommonSecretKeyAttributes) {
_cached_decoder_for_CommonSecretKeyAttributes = function (el) {
let keyLen;
let _unrecognizedExtensionsList = [];
const callbacks = {
keyLen: (_el) => {
keyLen = $._decodeInteger(_el);
},
};
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_CommonSecretKeyAttributes, exports._extension_additions_list_spec_for_CommonSecretKeyAttributes, exports._root_component_type_list_2_spec_for_CommonSecretKeyAttributes, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new CommonSecretKeyAttributes(keyLen, _unrecognizedExtensionsList);
};
}
return _cached_decoder_for_CommonSecretKeyAttributes(el);
}
exports._decode_CommonSecretKeyAttributes = _decode_CommonSecretKeyAttributes;
let _cached_encoder_for_CommonSecretKeyAttributes = null;
function _encode_CommonSecretKeyAttributes(value, elGetter) {
if (!_cached_encoder_for_CommonSecretKeyAttributes) {
_cached_encoder_for_CommonSecretKeyAttributes = function (value, elGetter) {
return $._encodeSequence([]
.concat([
value.keyLen === undefined
? undefined
: $._encodeInteger(value.keyLen, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_CommonSecretKeyAttributes(value, elGetter);
}
exports._encode_CommonSecretKeyAttributes = _encode_CommonSecretKeyAttributes;
//# sourceMappingURL=CommonSecretKeyAttributes.ta.js.map