@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
51 lines (50 loc) • 1.71 kB
JavaScript
import { _PdfPublicKeyCryptographyCertificate } from './pdf-cryptography-certificate';
/**
* Helper representing a certificate identifier (subject key identifier) wrapper.
*
* @private
*/
var _PdfCertificateIdentifier = /** @class */ (function () {
function _PdfCertificateIdentifier(params) {
if (params.pubicKey && params.id) {
this._identifier = new _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;
};
/**
* Compute a simple hash code for the identifier bytes.
*
* @private
* @returns {number} 32-bit integer hash of the identifier.
*/
_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;
}());
export { _PdfCertificateIdentifier };