define(["require", "exports", "../asn1/enumerator", "../asn1/abstract-syntax", "../asn1/unique-encoding-element", "./x509-algorithm", "./x509-bit-string-handler", "./x509-signed-certificate"], function (require, exports, enumerator_1, abstract_syntax_1, unique_encoding_element_1, x509_algorithm_1, x509_bit_string_handler_1, x509_signed_certificate_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _PdfX509CertificateStructure = (function () {
function _PdfX509CertificateStructure(seq) {
if (seq) {
if (!Array.isArray(seq) || seq.length !== 3) {
throw new Error("Invalid certificate sequence length: " + seq.length);
}
this._sequence = seq;
this._toBeSignedCertificate = new x509_signed_certificate_1._PdfSignedCertificate(seq[0]);
this._signatureAlgorithmIdentifier = new x509_algorithm_1._PdfAlgorithms(seq[1]);
this._signature = new x509_bit_string_handler_1._PdfUniqueBitString(seq[2]._getValue());
}
}
_PdfX509CertificateStructure.prototype._getSignedCertificate = function () {
return this._toBeSignedCertificate;
};
_PdfX509CertificateStructure.prototype._getInstance = function (obj) {
if (Array.isArray(obj) && obj.every(function (e) { return e instanceof abstract_syntax_1._PdfAbstractSyntaxElement; })) {
var seq = obj;
return new _PdfX509CertificateStructure(seq);
}
return null;
};
_PdfX509CertificateStructure.prototype._getDerEncoded = function () {
var der = new unique_encoding_element_1._PdfUniqueEncodingElement();
der._tagClass = enumerator_1._TagClassType.universal;
der._construction = enumerator_1._ConstructionType.constructed;
der._setTagNumber(enumerator_1._UniversalType.sequence);
der._setSequence(this._sequence);
return der._toBytes();
};
return _PdfX509CertificateStructure;
}());
exports._PdfX509CertificateStructure = _PdfX509CertificateStructure;
});
|