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.
This commit is contained in:
Jonas Jenwald 2026-07-16 15:31:36 +02:00
parent e39b23904c
commit 01454570a7

View File

@ -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");
};