You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2026/02/16 12:02:16 UTC
svn commit: r1931886 - pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption
Author: tilman
Date: Mon Feb 16 12:02:15 2026
New Revision: 1931886
Log:
PDFBOX-5660: optimize, as suggested by Valery Bokov; closes #420
Modified:
pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
Modified: pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
==============================================================================
--- pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java Mon Feb 16 09:41:57 2026 (r1931885)
+++ pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java Mon Feb 16 12:02:15 2026 (r1931886)
@@ -152,8 +152,10 @@ public final class StandardSecurityHandl
throw new IOException("Decryption material is not compatible with the document");
}
+ int encryptionVersion = encryption.getVersion();
// This is only used with security version 4 and 5.
- if (encryption.getVersion() >= REVISION_4) {
+ if (encryptionVersion >= REVISION_4)
+ {
setStreamFilterName(encryption.getStreamFilterName());
setStringFilterName(encryption.getStringFilterName());
}
@@ -168,9 +170,9 @@ public final class StandardSecurityHandl
int dicPermissions = encryption.getPermissions();
int dicRevision = encryption.getRevision();
- int dicLength = encryption.getVersion() == 1 ? 5 : encryption.getLength() / 8;
+ int dicLength = encryptionVersion == 1 ? 5 : encryption.getLength() / 8;
- if (encryption.getVersion() == REVISION_4 || encryption.getVersion() == REVISION_5)
+ if (encryptionVersion == REVISION_4 || encryptionVersion == REVISION_5)
{
// detect whether AES encryption is used. This assumes that the encryption algo is
// stored in the PDCryptFilterDictionary