define(["require", "exports", "./pdf-cryptography-certificate"], function (require, exports, pdf_cryptography_certificate_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _PdfCertificateIdentifier = (function () {
function _PdfCertificateIdentifier(params) {
if (params.pubicKey && params.id) {
this._identifier = new pdf_cryptography_certificate_1._PdfPublicKeyCryptographyCertificate()._createSubjectKeyID(params.pubicKey, params.id)._bytes;
}
else if (params.id) {
this._identifier = params.id;
}
}
_PdfCertificateIdentifier.prototype.equals = function (other) {
if (!(other instanceof _PdfCertificateIdentifier)) {
return false;
}
if (!this._identifier || !other._identifier || this._identifier.length !== other._identifier.length) {
return false;
}
for (var i = 0; i < this._identifier.length; i++) {
if (this._identifier[i] !== other._identifier[i]) {
return false;
}
}
return true;
};
_PdfCertificateIdentifier.prototype._getHashCode = function () {
if (!this._identifier) {
return 0;
}
var hash = 0;
for (var i = 0; i < this._identifier.length; i++) {
var byte = this._identifier[i];
hash = ((hash << 5) - hash) + byte;
hash |= 0;
}
return hash;
};
return _PdfCertificateIdentifier;
}());
exports._PdfCertificateIdentifier = _PdfCertificateIdentifier;
});
|