From 01454570a703d697437fcac49357592a35b8f2ee Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 16 Jul 2026 15:31:36 +0200 Subject: [PATCH] Reduce duplication in `CipherTransformFactory.prototype.createCipherTransform` After PR 21485 the `AES256Cipher` case is effectively duplicated, and while it's not a lot of code it's easy enough to avoid that. --- src/core/crypto.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/core/crypto.js b/src/core/crypto.js index 744254e29..24e201d88 100644 --- a/src/core/crypto.js +++ b/src/core/crypto.js @@ -1280,7 +1280,7 @@ class CipherTransformFactory { PasswordResponses.NEED_PASSWORD ); } - if (this.algorithm === 5) { + if (this.algorithm === 5 || cfm.name === "AESV3") { // V=5 always uses 256-bit AES with the file encryption key, even // when a producer wrongly sets the crypt filter's CFM to AESV2 // (bug 2046659). @@ -1308,9 +1308,6 @@ class CipherTransformFactory { ) ); } - if (cfm.name === "AESV3") { - return AES256Cipher.bind(null, this.encryptionKey); - } throw new FormatError("Unknown crypto method"); };