pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1669005 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
Date Tue, 24 Mar 2015 22:04:01 GMT
Author: tilman
Date: Tue Mar 24 22:04:00 2015
New Revision: 1669005

URL: http://svn.apache.org/r1669005
Log:
PDFBOX-2576: use common charsets

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java?rev=1669005&r1=1669004&r2=1669005&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
Tue Mar 24 22:04:00 2015
@@ -37,6 +37,8 @@ import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSString;
 import org.apache.pdfbox.pdmodel.PDDocument;
+import static org.apache.pdfbox.util.Charsets.ISO_8859_1_CHARSET;
+import static org.apache.pdfbox.util.Charsets.UTF_8_CHARSET;
 
 /**
  * The standard security handler. This security handler protects document with password.
@@ -73,9 +75,6 @@ public final class StandardSecurityHandl
     // hashes used for Algorithm 2.B, depending on remainder from E modulo 3
     private static final String[] HASHES_2B = new String[] {"SHA-256", "SHA-384", "SHA-512"};
 
-    private static final Charset ISO_8859_1_CHARSET = Charset.forName("ISO-8859-1");
-    private static final Charset UTF_8_CHARSET = Charset.forName("UTF-8");
-
     private static final int DEFAULT_VERSION = 1;
 
     private StandardProtectionPolicy policy;
@@ -854,7 +853,7 @@ public final class StandardSecurityHandl
                 digest = md.digest();
             }
         }
-        byte[] rc4Key = new byte[(int) length];
+        byte[] rc4Key = new byte[length];
         System.arraycopy(digest, 0, rc4Key, 0, length);
         return rc4Key;
     }



Mime
View raw message