@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.
- package/CHANGELOG.md +8 -0
- package/dist/ej2-pdf.umd.min.js +2 -2
- package/dist/ej2-pdf.umd.min.js.map +1 -1
- package/dist/es6/ej2-pdf.es2015.js +12 -9
- package/dist/es6/ej2-pdf.es2015.js.map +1 -1
- package/dist/es6/ej2-pdf.es5.js +12 -9
- package/dist/es6/ej2-pdf.es5.js.map +1 -1
- package/dist/global/ej2-pdf.min.js +2 -2
- package/dist/global/ej2-pdf.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/pdf/core/security/encryptor.js +12 -9
|
@@ -37461,21 +37461,21 @@ class _PdfEncryptor {
|
|
|
37461
37461
|
else {
|
|
37462
37462
|
algorithm = new _BasicEncryption();
|
|
37463
37463
|
}
|
|
37464
|
-
let
|
|
37464
|
+
let p;
|
|
37465
37465
|
if (passwordBytes) {
|
|
37466
|
-
|
|
37466
|
+
p = passwordBytes.subarray(0, Math.min(127, passwordBytes.length));
|
|
37467
37467
|
}
|
|
37468
37468
|
else {
|
|
37469
|
-
|
|
37469
|
+
p = new Uint8Array([]);
|
|
37470
37470
|
}
|
|
37471
|
-
if (algorithm._checkUserPassword(
|
|
37472
|
-
encryptionKey = this._createEncryptionKey(true,
|
|
37471
|
+
if (algorithm._checkUserPassword(p, userValidationSalt, userPassword)) {
|
|
37472
|
+
encryptionKey = this._createEncryptionKey(true, p, ownerKeySalt, uBytes, userKeySalt, ownerEncryption, userEncryption, algorithm);
|
|
37473
37473
|
this._isUserPassword = true;
|
|
37474
|
-
if (password.length && algorithm._checkOwnerPassword(
|
|
37474
|
+
if (password.length && algorithm._checkOwnerPassword(p, ownerValidationSalt, uBytes, ownerPassword)) {
|
|
37475
37475
|
this._hasUserPasswordOnly = true;
|
|
37476
37476
|
}
|
|
37477
37477
|
}
|
|
37478
|
-
else if (password.length && algorithm._checkOwnerPassword(
|
|
37478
|
+
else if (password.length && algorithm._checkOwnerPassword(p, ownerValidationSalt, uBytes, ownerPassword)) {
|
|
37479
37479
|
encryptionKey = this._createEncryptionKey(false, passwordBytes, ownerKeySalt, uBytes, userKeySalt, ownerEncryption, userEncryption, algorithm);
|
|
37480
37480
|
this._isUserPassword = false;
|
|
37481
37481
|
}
|
|
@@ -37490,7 +37490,6 @@ class _PdfEncryptor {
|
|
|
37490
37490
|
throw new Error('Cannot open an encrypted document. The password is invalid.');
|
|
37491
37491
|
}
|
|
37492
37492
|
}
|
|
37493
|
-
this._encryptionKey = encryptionKey;
|
|
37494
37493
|
if (algorithm >= 4) {
|
|
37495
37494
|
const cipherDictionary = dictionary.get('CF');
|
|
37496
37495
|
if (cipherDictionary) {
|
|
@@ -37510,6 +37509,10 @@ class _PdfEncryptor {
|
|
|
37510
37509
|
this._string = dictionary.get('StrF') || _PdfName.get('Identity');
|
|
37511
37510
|
this._eff = dictionary.get('EFF') || this._stream;
|
|
37512
37511
|
}
|
|
37512
|
+
if (!encryptionKey && !this._encryptOnlyAttachment) {
|
|
37513
|
+
throw new Error('Cannot open an encrypted document. The password is invalid.');
|
|
37514
|
+
}
|
|
37515
|
+
this._encryptionKey = encryptionKey;
|
|
37513
37516
|
}
|
|
37514
37517
|
get _md5() {
|
|
37515
37518
|
if (typeof this._messageDigest === 'undefined') {
|
|
@@ -38850,7 +38853,7 @@ class _AdvancedEncryption256Cipher extends _AdvancedEncryptionBaseCipher {
|
|
|
38850
38853
|
}
|
|
38851
38854
|
}
|
|
38852
38855
|
for (let n = 0; n < 4; ++n) {
|
|
38853
|
-
result[Number.parseInt(
|
|
38856
|
+
result[Number.parseInt(j.toString(), 10)] = t1 ^= result[j - 32];
|
|
38854
38857
|
result[j + 1] = t2 ^= result[j - 31];
|
|
38855
38858
|
result[j + 2] = t3 ^= result[j - 30];
|
|
38856
38859
|
result[j + 3] = t4 ^= result[j - 29];
|