pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1855022 - in /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption: PDEncryption.java PublicKeySecurityHandler.java StandardSecurityHandler.java
Date Fri, 08 Mar 2019 06:25:41 GMT
Author: tilman
Date: Fri Mar  8 06:25:40 2019
New Revision: 1855022

URL: http://svn.apache.org/viewvc?rev=1855022&view=rev
Log:
PDFBOX-4436: make PDEncryption a COSObjectable

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java?rev=1855022&r1=1855021&r2=1855022&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PDEncryption.java
Fri Mar  8 06:25:40 2019
@@ -25,6 +25,7 @@ import org.apache.pdfbox.cos.COSBoolean;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSString;
+import org.apache.pdfbox.pdmodel.common.COSObjectable;
 
 /**
  * This class is a specialized view of the encryption dictionary of a PDF document.
@@ -37,7 +38,7 @@ import org.apache.pdfbox.cos.COSString;
  * @author Ben Litchfield
  * @author Benoit Guillon
  */
-public class PDEncryption
+public class PDEncryption implements COSObjectable
 {
     /**
      * See PDF Reference 1.4 Table 3.13.
@@ -133,11 +134,24 @@ public class PDEncryption
      * This will get the dictionary associated with this encryption dictionary.
      *
      * @return The COS dictionary that this object wraps.
+     * @deprecated use {@link #getCOSObject() }
      */
+    @Deprecated
     public COSDictionary getCOSDictionary()
     {
         return dictionary;
     }
+
+    /**
+     * This will get the dictionary associated with this encryption dictionary.
+     *
+     * @return The COS dictionary that this object wraps.
+     */
+    @Override
+    public COSDictionary getCOSObject()
+    {
+        return dictionary;
+    }
 
     /**
      * Sets the filter entry of the encryption dictionary.

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java?rev=1855022&r1=1855021&r2=1855022&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java
Fri Mar  8 06:25:40 2019
@@ -152,7 +152,7 @@ public final class PublicKeySecurityHand
             byte[] envelopedData = null;
 
             // the bytes of each recipient in the recipients array
-            COSArray array = (COSArray) encryption.getCOSDictionary().getItem(COSName.RECIPIENTS);
+            COSArray array = (COSArray) encryption.getCOSObject().getItem(COSName.RECIPIENTS);
             if (array == null)
             {
                 PDCryptFilterDictionary defaultCryptFilterDictionary = encryption.getDefaultCryptFilterDictionary();
@@ -384,7 +384,7 @@ public final class PublicKeySecurityHand
             System.arraycopy(mdResult, 0, this.encryptionKey, 0, this.keyLength/8);
 
             doc.setEncryptionDictionary(dictionary);
-            doc.getDocument().setEncryptionDictionary(dictionary.getCOSDictionary());
+            doc.getDocument().setEncryptionDictionary(dictionary.getCOSObject());
         }
         catch(GeneralSecurityException e)
         {

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java?rev=1855022&r1=1855021&r2=1855022&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardSecurityHandler.java
Fri Mar  8 06:25:40 2019
@@ -396,7 +396,7 @@ public final class StandardSecurityHandl
         }
 
         document.setEncryptionDictionary( encryptionDictionary );
-        document.getDocument().setEncryptionDictionary(encryptionDictionary.getCOSDictionary());
+        document.getDocument().setEncryptionDictionary(encryptionDictionary.getCOSObject());
     }
 
     private void prepareEncryptionDictRev6(String ownerPassword, String userPassword,



Mime
View raw message