pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1860487 - in /pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption: SaslPrep.java StandardSecurityHandler.java
Date Sat, 01 Jun 2019 17:55:38 GMT
Author: tilman
Date: Sat Jun  1 17:55:38 2019
New Revision: 1860487

URL: http://svn.apache.org/viewvc?rev=1860487&view=rev
Log:
PDFBOX-4155: use SASLprep algorithm implementation by Tom Bentley for revision 6, as suggested
by Marc Kaufman

Added:
    pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SaslPrep.java
      - copied unchanged from r1860486, pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SaslPrep.java
Modified:
    pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java

Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java?rev=1860487&r1=1860486&r2=1860487&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
(original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
Sat Jun  1 17:55:38 2019
@@ -202,7 +202,12 @@ public final class StandardSecurityHandl
             ue = encryption.getUserEncryptionKey();
             oe = encryption.getOwnerEncryptionKey();
         }
-        
+
+        if (dicRevision == 6)
+        {
+            password = SaslPrep.saslPrepQuery(password); // PDFBOX-4155
+        }
+
         AccessPermission currentAccessPermission;
 
         if( isOwnerPassword(password.getBytes(passwordCharset), userKey, ownerKey,
@@ -372,7 +377,7 @@ public final class StandardSecurityHandl
         {
             userPassword = "";
         }
- 
+
         // If no owner password is set, use the user password instead.
         if (ownerPassword.isEmpty())
         {
@@ -387,6 +392,9 @@ public final class StandardSecurityHandl
 
         if (revision == 6)
         {
+            // PDFBOX-4155
+            ownerPassword = SaslPrep.saslPrepStored(ownerPassword);
+            userPassword = SaslPrep.saslPrepStored(userPassword);
             prepareEncryptionDictRev6(ownerPassword, userPassword, encryptionDictionary,
permissionInt);
         }
         else



Mime
View raw message