@syncfusion/ej2-pdf 23.1.38 → 23.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38936,21 +38936,21 @@ var _PdfEncryptor = /** @__PURE__ @class */ (function () {
38936
38936
  else {
38937
38937
  algorithm_1 = new _BasicEncryption();
38938
38938
  }
38939
- var password_1;
38939
+ var p = void 0;
38940
38940
  if (passwordBytes) {
38941
- password_1 = passwordBytes.subarray(0, Math.min(127, passwordBytes.length));
38941
+ p = passwordBytes.subarray(0, Math.min(127, passwordBytes.length));
38942
38942
  }
38943
38943
  else {
38944
- password_1 = new Uint8Array([]);
38944
+ p = new Uint8Array([]);
38945
38945
  }
38946
- if (algorithm_1._checkUserPassword(password_1, userValidationSalt, userPassword)) {
38947
- encryptionKey = this._createEncryptionKey(true, password_1, ownerKeySalt, uBytes, userKeySalt, ownerEncryption, userEncryption, algorithm_1);
38946
+ if (algorithm_1._checkUserPassword(p, userValidationSalt, userPassword)) {
38947
+ encryptionKey = this._createEncryptionKey(true, p, ownerKeySalt, uBytes, userKeySalt, ownerEncryption, userEncryption, algorithm_1);
38948
38948
  this._isUserPassword = true;
38949
- if (password_1.length && algorithm_1._checkOwnerPassword(password_1, ownerValidationSalt, uBytes, ownerPassword)) {
38949
+ if (password.length && algorithm_1._checkOwnerPassword(p, ownerValidationSalt, uBytes, ownerPassword)) {
38950
38950
  this._hasUserPasswordOnly = true;
38951
38951
  }
38952
38952
  }
38953
- else if (password_1.length && algorithm_1._checkOwnerPassword(password_1, ownerValidationSalt, uBytes, ownerPassword)) {
38953
+ else if (password.length && algorithm_1._checkOwnerPassword(p, ownerValidationSalt, uBytes, ownerPassword)) {
38954
38954
  encryptionKey = this._createEncryptionKey(false, passwordBytes, ownerKeySalt, uBytes, userKeySalt, ownerEncryption, userEncryption, algorithm_1);
38955
38955
  this._isUserPassword = false;
38956
38956
  }
@@ -38965,7 +38965,6 @@ var _PdfEncryptor = /** @__PURE__ @class */ (function () {
38965
38965
  throw new Error('Cannot open an encrypted document. The password is invalid.');
38966
38966
  }
38967
38967
  }
38968
- this._encryptionKey = encryptionKey;
38969
38968
  if (algorithm >= 4) {
38970
38969
  var cipherDictionary = dictionary.get('CF');
38971
38970
  if (cipherDictionary) {
@@ -38985,6 +38984,10 @@ var _PdfEncryptor = /** @__PURE__ @class */ (function () {
38985
38984
  this._string = dictionary.get('StrF') || _PdfName.get('Identity');
38986
38985
  this._eff = dictionary.get('EFF') || this._stream;
38987
38986
  }
38987
+ if (!encryptionKey && !this._encryptOnlyAttachment) {
38988
+ throw new Error('Cannot open an encrypted document. The password is invalid.');
38989
+ }
38990
+ this._encryptionKey = encryptionKey;
38988
38991
  }
38989
38992
  Object.defineProperty(_PdfEncryptor.prototype, "_md5", {
38990
38993
  get: function () {
@@ -40377,7 +40380,7 @@ var _AdvancedEncryption256Cipher = /** @__PURE__ @class */ (function (_super) {
40377
40380
  }
40378
40381
  }
40379
40382
  for (var n = 0; n < 4; ++n) {
40380
- result[Number.parseInt(i.toString(), 10)] = t1 ^= result[j - 32];
40383
+ result[Number.parseInt(j.toString(), 10)] = t1 ^= result[j - 32];
40381
40384
  result[j + 1] = t2 ^= result[j - 31];
40382
40385
  result[j + 2] = t3 ^= result[j - 30];
40383
40386
  result[j + 3] = t4 ^= result[j - 29];