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 2020/09/18 15:28:53 UTC
svn commit: r1881823 - in
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption:
ProtectionPolicy.java StandardProtectionPolicy.java
Author: tilman
Date: Fri Sep 18 15:28:52 2020
New Revision: 1881823
URL: http://svn.apache.org/viewvc?rev=1881823&view=rev
Log:
PDFBOX-4421: pull up AES stuff because it will be used by both security handlers, as suggested by Christian Appl
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/ProtectionPolicy.java
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardProtectionPolicy.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/ProtectionPolicy.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/ProtectionPolicy.java?rev=1881823&r1=1881822&r2=1881823&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/ProtectionPolicy.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/ProtectionPolicy.java Fri Sep 18 15:28:52 2020
@@ -33,6 +33,7 @@ public abstract class ProtectionPolicy
private static final int DEFAULT_KEY_LENGTH = 40;
private int encryptionKeyLength = DEFAULT_KEY_LENGTH;
+ private boolean preferAES = false;
/**
* set the length in (bits) of the secret key that will be
@@ -61,4 +62,28 @@ public abstract class ProtectionPolicy
{
return encryptionKeyLength;
}
+
+ /**
+ * Tell whether AES encryption is preferred when several encryption methods are available for
+ * the chosen key length. The default is false. This setting is only relevant if the key length
+ * is 128 bits.
+ *
+ * @return true if AES encryption is preferred
+ */
+ public boolean isPreferAES()
+ {
+ return this.preferAES;
+ }
+
+ /**
+ * Set whether AES encryption is preferred when several encryption methods are available for the
+ * chosen key length. The default is false. This setting is only relevant if the key length is
+ * 128 bits.
+ *
+ * @param preferAES
+ */
+ public void setPreferAES(boolean preferAES)
+ {
+ this.preferAES = preferAES;
+ }
}
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardProtectionPolicy.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardProtectionPolicy.java?rev=1881823&r1=1881822&r2=1881823&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardProtectionPolicy.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/StandardProtectionPolicy.java Fri Sep 18 15:28:52 2020
@@ -40,7 +40,6 @@ public final class StandardProtectionPol
private String ownerPassword = "";
@SuppressWarnings({"squid:S2068"})
private String userPassword = "";
- private boolean preferAES = false;
/**
* Creates an new instance of the standard protection policy
@@ -111,28 +110,4 @@ public final class StandardProtectionPol
{
this.userPassword = userPassword;
}
-
- /**
- * Tell whether AES encryption is preferred when several encryption methods are available for
- * the chosen key length. The default is false. This setting is only relevant if the key length
- * is 128 bits.
- *
- * @return true if AES encryption is preferred
- */
- public boolean isPreferAES()
- {
- return this.preferAES;
- }
-
- /**
- * Set whether AES encryption is preferred when several encryption methods are available for the
- * chosen key length. The default is false. This setting is only relevant if the key length is
- * 128 bits.
- *
- * @param preferAES
- */
- public void setPreferAES(boolean preferAES)
- {
- this.preferAES = preferAES;
- }
}