mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-26 00:47:21 +02:00
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:
parent
e39b23904c
commit
01454570a7
@ -1280,7 +1280,7 @@ class CipherTransformFactory {
|
|||||||
PasswordResponses.NEED_PASSWORD
|
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
|
// 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
|
// when a producer wrongly sets the crypt filter's CFM to AESV2
|
||||||
// (bug 2046659).
|
// (bug 2046659).
|
||||||
@ -1308,9 +1308,6 @@ class CipherTransformFactory {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (cfm.name === "AESV3") {
|
|
||||||
return AES256Cipher.bind(null, this.encryptionKey);
|
|
||||||
}
|
|
||||||
throw new FormatError("Unknown crypto method");
|
throw new FormatError("Unknown crypto method");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user