define(["require", "exports", "./x509-algorithm", "./x509-bit-string-handler"], function (require, exports, x509_algorithm_1, x509_bit_string_handler_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _PdfPublicKeyInformation = (function () {
function _PdfPublicKeyInformation(algorithms, publicKey) {
if (algorithms && publicKey) {
this._algorithms = algorithms;
this._publicKey = publicKey;
}
}
_PdfPublicKeyInformation.prototype._fromAbstractSyntax = function (abstractSyntaxSequence) {
var sequence = abstractSyntaxSequence._getSequence();
if (!Array.isArray(sequence) || sequence.length !== 2) {
throw new Error('Invalid length in sequence');
}
var algorithms = new x509_algorithm_1._PdfAlgorithms()._getAlgorithms(sequence[0]);
var publicKey = new x509_bit_string_handler_1._PdfUniqueBitString()._fromAbstractSyntaxOctets(sequence[1]._getValue());
return new _PdfPublicKeyInformation(algorithms, publicKey);
};
_PdfPublicKeyInformation.prototype._getPublicKeyInformation = function (obj) {
if (obj instanceof _PdfPublicKeyInformation) {
return obj;
}
if (obj && obj._getSequence()) {
return this._fromAbstractSyntax(obj);
}
return undefined;
};
return _PdfPublicKeyInformation;
}());
exports._PdfPublicKeyInformation = _PdfPublicKeyInformation;
});
|