pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
181 lines • 14.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_PinAttributes = exports._decode_PinAttributes = exports._extension_additions_list_spec_for_PinAttributes = exports._root_component_type_list_2_spec_for_PinAttributes = exports._root_component_type_list_1_spec_for_PinAttributes = exports.PinAttributes = exports._encode_Reference = exports._decode_Reference = exports._enum_for_PinType = exports._encode_PinType = exports._decode_PinType = exports.utf8 = exports.PinType_utf8 = exports.PinType_iso9564_1 = exports.PinType_half_nibble_bcd = exports.PinType_bcd = exports.PinType_ascii_numeric = exports.iso9564_1 = exports.half_nibble_bcd = exports.bcd = exports.ascii_numeric = exports._encode_PinFlags = exports._decode_PinFlags = exports.unblock_disabled = exports.unblockingPin = exports.soPin = exports.PinFlags_unblock_disabled = exports.PinFlags_unblockingPin = exports.PinFlags_soPin = exports.PinFlags_needs_padding = exports.PinFlags_local = exports.PinFlags_integrity_protected = exports.PinFlags_initialized = exports.PinFlags_exchangeRefData = exports.PinFlags_disable_allowed = exports.PinFlags_confidentiality_protected = exports.PinFlags_change_disabled = exports.PinFlags_case_sensitive = exports.needs_padding = exports.local = exports.integrity_protected = exports.initialized = exports.exchangeRefData = exports.disable_allowed = exports.confidentiality_protected = exports.change_disabled = exports.case_sensitive = exports._encode_Path = exports._decode_Path = exports.Path = 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 Path_ta_1 = require("../PKCS-15/Path.ta");
const PinFlags_ta_1 = require("../PKCS-15/PinFlags.ta");
const PinType_ta_1 = require("../PKCS-15/PinType.ta");
const Reference_ta_1 = require("../PKCS-15/Reference.ta");
var Path_ta_2 = require("../PKCS-15/Path.ta");
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Path_ta_2.Path; } });
Object.defineProperty(exports, "_decode_Path", { enumerable: true, get: function () { return Path_ta_2._decode_Path; } });
Object.defineProperty(exports, "_encode_Path", { enumerable: true, get: function () { return Path_ta_2._encode_Path; } });
var PinFlags_ta_2 = require("../PKCS-15/PinFlags.ta");
Object.defineProperty(exports, "case_sensitive", { enumerable: true, get: function () { return PinFlags_ta_2.case_sensitive; } });
Object.defineProperty(exports, "change_disabled", { enumerable: true, get: function () { return PinFlags_ta_2.change_disabled; } });
Object.defineProperty(exports, "confidentiality_protected", { enumerable: true, get: function () { return PinFlags_ta_2.confidentiality_protected; } });
Object.defineProperty(exports, "disable_allowed", { enumerable: true, get: function () { return PinFlags_ta_2.disable_allowed; } });
Object.defineProperty(exports, "exchangeRefData", { enumerable: true, get: function () { return PinFlags_ta_2.exchangeRefData; } });
Object.defineProperty(exports, "initialized", { enumerable: true, get: function () { return PinFlags_ta_2.initialized; } });
Object.defineProperty(exports, "integrity_protected", { enumerable: true, get: function () { return PinFlags_ta_2.integrity_protected; } });
Object.defineProperty(exports, "local", { enumerable: true, get: function () { return PinFlags_ta_2.local; } });
Object.defineProperty(exports, "needs_padding", { enumerable: true, get: function () { return PinFlags_ta_2.needs_padding; } });
Object.defineProperty(exports, "PinFlags_case_sensitive", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_case_sensitive; } });
Object.defineProperty(exports, "PinFlags_change_disabled", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_change_disabled; } });
Object.defineProperty(exports, "PinFlags_confidentiality_protected", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_confidentiality_protected; } });
Object.defineProperty(exports, "PinFlags_disable_allowed", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_disable_allowed; } });
Object.defineProperty(exports, "PinFlags_exchangeRefData", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_exchangeRefData; } });
Object.defineProperty(exports, "PinFlags_initialized", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_initialized; } });
Object.defineProperty(exports, "PinFlags_integrity_protected", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_integrity_protected; } });
Object.defineProperty(exports, "PinFlags_local", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_local; } });
Object.defineProperty(exports, "PinFlags_needs_padding", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_needs_padding; } });
Object.defineProperty(exports, "PinFlags_soPin", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_soPin; } });
Object.defineProperty(exports, "PinFlags_unblockingPin", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_unblockingPin; } });
Object.defineProperty(exports, "PinFlags_unblock_disabled", { enumerable: true, get: function () { return PinFlags_ta_2.PinFlags_unblock_disabled; } });
Object.defineProperty(exports, "soPin", { enumerable: true, get: function () { return PinFlags_ta_2.soPin; } });
Object.defineProperty(exports, "unblockingPin", { enumerable: true, get: function () { return PinFlags_ta_2.unblockingPin; } });
Object.defineProperty(exports, "unblock_disabled", { enumerable: true, get: function () { return PinFlags_ta_2.unblock_disabled; } });
Object.defineProperty(exports, "_decode_PinFlags", { enumerable: true, get: function () { return PinFlags_ta_2._decode_PinFlags; } });
Object.defineProperty(exports, "_encode_PinFlags", { enumerable: true, get: function () { return PinFlags_ta_2._encode_PinFlags; } });
var PinType_ta_2 = require("../PKCS-15/PinType.ta");
Object.defineProperty(exports, "ascii_numeric", { enumerable: true, get: function () { return PinType_ta_2.ascii_numeric; } });
Object.defineProperty(exports, "bcd", { enumerable: true, get: function () { return PinType_ta_2.bcd; } });
Object.defineProperty(exports, "half_nibble_bcd", { enumerable: true, get: function () { return PinType_ta_2.half_nibble_bcd; } });
Object.defineProperty(exports, "iso9564_1", { enumerable: true, get: function () { return PinType_ta_2.iso9564_1; } });
Object.defineProperty(exports, "PinType_ascii_numeric", { enumerable: true, get: function () { return PinType_ta_2.PinType_ascii_numeric; } });
Object.defineProperty(exports, "PinType_bcd", { enumerable: true, get: function () { return PinType_ta_2.PinType_bcd; } });
Object.defineProperty(exports, "PinType_half_nibble_bcd", { enumerable: true, get: function () { return PinType_ta_2.PinType_half_nibble_bcd; } });
Object.defineProperty(exports, "PinType_iso9564_1", { enumerable: true, get: function () { return PinType_ta_2.PinType_iso9564_1; } });
Object.defineProperty(exports, "PinType_utf8", { enumerable: true, get: function () { return PinType_ta_2.PinType_utf8; } });
Object.defineProperty(exports, "utf8", { enumerable: true, get: function () { return PinType_ta_2.utf8; } });
Object.defineProperty(exports, "_decode_PinType", { enumerable: true, get: function () { return PinType_ta_2._decode_PinType; } });
Object.defineProperty(exports, "_encode_PinType", { enumerable: true, get: function () { return PinType_ta_2._encode_PinType; } });
Object.defineProperty(exports, "_enum_for_PinType", { enumerable: true, get: function () { return PinType_ta_2._enum_for_PinType; } });
var Reference_ta_2 = require("../PKCS-15/Reference.ta");
Object.defineProperty(exports, "_decode_Reference", { enumerable: true, get: function () { return Reference_ta_2._decode_Reference; } });
Object.defineProperty(exports, "_encode_Reference", { enumerable: true, get: function () { return Reference_ta_2._encode_Reference; } });
class PinAttributes {
constructor(pinFlags, pinType, minLength, storedLength, maxLength, pinReference, padChar, lastPinChange, path, _unrecognizedExtensionsList = []) {
this.pinFlags = pinFlags;
this.pinType = pinType;
this.minLength = minLength;
this.storedLength = storedLength;
this.maxLength = maxLength;
this.pinReference = pinReference;
this.padChar = padChar;
this.lastPinChange = lastPinChange;
this.path = path;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
static _from_object(_o) {
return new PinAttributes(_o.pinFlags, _o.pinType, _o.minLength, _o.storedLength, _o.maxLength, _o.pinReference, _o.padChar, _o.lastPinChange, _o.path, _o._unrecognizedExtensionsList);
}
static get _default_value_for_pinReference() {
return 0;
}
}
exports.PinAttributes = PinAttributes;
PinAttributes._enum_for_pinType = PinType_ta_1._enum_for_PinType;
exports._root_component_type_list_1_spec_for_PinAttributes = [
new $.ComponentSpec("pinFlags", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 3), undefined, undefined),
new $.ComponentSpec("pinType", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 10), undefined, undefined),
new $.ComponentSpec("minLength", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 2), undefined, undefined),
new $.ComponentSpec("storedLength", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 2), undefined, undefined),
new $.ComponentSpec("maxLength", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 2), undefined, undefined),
new $.ComponentSpec("pinReference", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined),
new $.ComponentSpec("padChar", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 4), undefined, undefined),
new $.ComponentSpec("lastPinChange", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 24), undefined, undefined),
new $.ComponentSpec("path", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined),
];
exports._root_component_type_list_2_spec_for_PinAttributes = [];
exports._extension_additions_list_spec_for_PinAttributes = [];
let _cached_decoder_for_PinAttributes = null;
function _decode_PinAttributes(el) {
if (!_cached_decoder_for_PinAttributes) {
_cached_decoder_for_PinAttributes = function (el) {
let pinFlags;
let pinType;
let minLength;
let storedLength;
let maxLength;
let pinReference = PinAttributes._default_value_for_pinReference;
let padChar;
let lastPinChange;
let path;
let _unrecognizedExtensionsList = [];
const callbacks = {
pinFlags: (_el) => {
pinFlags = PinFlags_ta_1._decode_PinFlags(_el);
},
pinType: (_el) => {
pinType = PinType_ta_1._decode_PinType(_el);
},
minLength: (_el) => {
minLength = $._decodeInteger(_el);
},
storedLength: (_el) => {
storedLength = $._decodeInteger(_el);
},
maxLength: (_el) => {
maxLength = $._decodeInteger(_el);
},
pinReference: (_el) => {
pinReference = $._decode_implicit(() => Reference_ta_1._decode_Reference)(_el);
},
padChar: (_el) => {
padChar = $._decodeOctetString(_el);
},
lastPinChange: (_el) => {
lastPinChange = $._decodeGeneralizedTime(_el);
},
path: (_el) => {
path = Path_ta_1._decode_Path(_el);
},
};
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_PinAttributes, exports._extension_additions_list_spec_for_PinAttributes, exports._root_component_type_list_2_spec_for_PinAttributes, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new PinAttributes(pinFlags, pinType, minLength, storedLength, maxLength, pinReference, padChar, lastPinChange, path, _unrecognizedExtensionsList);
};
}
return _cached_decoder_for_PinAttributes(el);
}
exports._decode_PinAttributes = _decode_PinAttributes;
let _cached_encoder_for_PinAttributes = null;
function _encode_PinAttributes(value, elGetter) {
if (!_cached_encoder_for_PinAttributes) {
_cached_encoder_for_PinAttributes = function (value, elGetter) {
return $._encodeSequence([]
.concat([
PinFlags_ta_1._encode_PinFlags(value.pinFlags, $.BER),
PinType_ta_1._encode_PinType(value.pinType, $.BER),
$._encodeInteger(value.minLength, $.BER),
$._encodeInteger(value.storedLength, $.BER),
value.maxLength === undefined
? undefined
: $._encodeInteger(value.maxLength, $.BER),
value.pinReference === undefined ||
$.deepEq(value.pinReference, PinAttributes._default_value_for_pinReference)
? undefined
: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => Reference_ta_1._encode_Reference, $.BER)(value.pinReference, $.BER),
value.padChar === undefined
? undefined
: $._encodeOctetString(value.padChar, $.BER),
value.lastPinChange === undefined
? undefined
: $._encodeGeneralizedTime(value.lastPinChange, $.BER),
value.path === undefined
? undefined
: Path_ta_1._encode_Path(value.path, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_PinAttributes(value, elGetter);
}
exports._encode_PinAttributes = _encode_PinAttributes;
//# sourceMappingURL=PinAttributes.ta.js.map