pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
73 lines • 4.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_CommonDataObjectAttributes = exports._decode_CommonDataObjectAttributes = exports._extension_additions_list_spec_for_CommonDataObjectAttributes = exports._root_component_type_list_2_spec_for_CommonDataObjectAttributes = exports._root_component_type_list_1_spec_for_CommonDataObjectAttributes = exports.CommonDataObjectAttributes = exports._encode_Label = exports._decode_Label = 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 Label_ta_1 = require("../PKCS-15/Label.ta");
var Label_ta_2 = require("../PKCS-15/Label.ta");
Object.defineProperty(exports, "_decode_Label", { enumerable: true, get: function () { return Label_ta_2._decode_Label; } });
Object.defineProperty(exports, "_encode_Label", { enumerable: true, get: function () { return Label_ta_2._encode_Label; } });
class CommonDataObjectAttributes {
constructor(applicationName, applicationOID, _unrecognizedExtensionsList = []) {
this.applicationName = applicationName;
this.applicationOID = applicationOID;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
static _from_object(_o) {
return new CommonDataObjectAttributes(_o.applicationName, _o.applicationOID, _o._unrecognizedExtensionsList);
}
}
exports.CommonDataObjectAttributes = CommonDataObjectAttributes;
exports._root_component_type_list_1_spec_for_CommonDataObjectAttributes = [
new $.ComponentSpec("applicationName", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 12), undefined, undefined),
new $.ComponentSpec("applicationOID", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined),
];
exports._root_component_type_list_2_spec_for_CommonDataObjectAttributes = [];
exports._extension_additions_list_spec_for_CommonDataObjectAttributes = [];
let _cached_decoder_for_CommonDataObjectAttributes = null;
function _decode_CommonDataObjectAttributes(el) {
if (!_cached_decoder_for_CommonDataObjectAttributes) {
_cached_decoder_for_CommonDataObjectAttributes = function (el) {
let applicationName;
let applicationOID;
let _unrecognizedExtensionsList = [];
const callbacks = {
applicationName: (_el) => {
applicationName = Label_ta_1._decode_Label(_el);
},
applicationOID: (_el) => {
applicationOID = $._decodeObjectIdentifier(_el);
},
};
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_CommonDataObjectAttributes, exports._extension_additions_list_spec_for_CommonDataObjectAttributes, exports._root_component_type_list_2_spec_for_CommonDataObjectAttributes, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new CommonDataObjectAttributes(applicationName, applicationOID, _unrecognizedExtensionsList);
};
}
return _cached_decoder_for_CommonDataObjectAttributes(el);
}
exports._decode_CommonDataObjectAttributes = _decode_CommonDataObjectAttributes;
let _cached_encoder_for_CommonDataObjectAttributes = null;
function _encode_CommonDataObjectAttributes(value, elGetter) {
if (!_cached_encoder_for_CommonDataObjectAttributes) {
_cached_encoder_for_CommonDataObjectAttributes = function (value, elGetter) {
return $._encodeSequence([]
.concat([
value.applicationName === undefined
? undefined
: Label_ta_1._encode_Label(value.applicationName, $.BER),
value.applicationOID === undefined
? undefined
: $._encodeObjectIdentifier(value.applicationOID, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_CommonDataObjectAttributes(value, elGetter);
}
exports._encode_CommonDataObjectAttributes = _encode_CommonDataObjectAttributes;
//# sourceMappingURL=CommonDataObjectAttributes.ta.js.map