aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/pdf/PDFEncryptionParams.java
diff options
context:
space:
mode:
authorLuis Bernardo <lbernardo@apache.org>2013-05-18 22:25:52 +0000
committerLuis Bernardo <lbernardo@apache.org>2013-05-18 22:25:52 +0000
commit016cb3199865f798f401c452554eea6e74055950 (patch)
tree10635c8e78ce1124251a9e735088f20cc81619c7 /src/java/org/apache/fop/pdf/PDFEncryptionParams.java
parentaf665b918b7a15470f9006c7d217a9fc8ea7fcbd (diff)
downloadxmlgraphics-fop-016cb3199865f798f401c452554eea6e74055950.tar.gz
xmlgraphics-fop-016cb3199865f798f401c452554eea6e74055950.zip
FOP-2248: add support for AES 256 PDF encryption
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1484190 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/pdf/PDFEncryptionParams.java')
-rw-r--r--src/java/org/apache/fop/pdf/PDFEncryptionParams.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFEncryptionParams.java b/src/java/org/apache/fop/pdf/PDFEncryptionParams.java
index 563c05233..a1925b0f4 100644
--- a/src/java/org/apache/fop/pdf/PDFEncryptionParams.java
+++ b/src/java/org/apache/fop/pdf/PDFEncryptionParams.java
@@ -35,8 +35,9 @@ public class PDFEncryptionParams {
private boolean allowAccessContent = true;
private boolean allowAssembleDocument = true;
private boolean allowPrintHq = true;
+ private boolean encryptMetadata = true;
- private int encryptionLengthInBits = 40;
+ private int encryptionLengthInBits = 128;
/**
* Creates a new instance.
@@ -51,13 +52,15 @@ public class PDFEncryptionParams {
boolean allowPrint,
boolean allowCopyContent,
boolean allowEditContent,
- boolean allowEditAnnotations) {
+ boolean allowEditAnnotations,
+ boolean encryptMetadata) {
setUserPassword(userPassword);
setOwnerPassword(ownerPassword);
setAllowPrint(allowPrint);
setAllowCopyContent(allowCopyContent);
setAllowEditContent(allowEditContent);
setAllowEditAnnotations(allowEditAnnotations);
+ this.encryptMetadata = encryptMetadata;
}
/**
@@ -84,6 +87,7 @@ public class PDFEncryptionParams {
setAllowFillInForms(source.isAllowFillInForms());
setAllowPrintHq(source.isAllowPrintHq());
setEncryptionLengthInBits(source.getEncryptionLengthInBits());
+ encryptMetadata = source.encryptMetadata();
}
/**
@@ -151,6 +155,14 @@ public class PDFEncryptionParams {
}
/**
+ * Indicates whether Metadata should be encrypted.
+ * @return true or false
+ */
+ public boolean encryptMetadata() {
+ return encryptMetadata;
+ }
+
+ /**
* Returns the owner password.
* @return the owner password, an empty string if no password applies
*/
@@ -231,6 +243,14 @@ public class PDFEncryptionParams {
}
/**
+ * Whether the Metadata should be encrypted or not; default is true;
+ * @param encryptMetadata true or false
+ */
+ public void setEncryptMetadata(boolean encryptMetadata) {
+ this.encryptMetadata = encryptMetadata;
+ }
+
+ /**
* Sets the owner password.
* @param ownerPassword The owner password to set, null or an empty String
* if no password is applicable
@@ -283,7 +303,8 @@ public class PDFEncryptionParams {
+ "allowFillInForms = " + allowFillInForms + "\n"
+ "allowAccessContent = " + allowAccessContent + "\n"
+ "allowAssembleDocument = " + allowAssembleDocument + "\n"
- + "allowPrintHq = " + allowPrintHq;
+ + "allowPrintHq = " + allowPrintHq + "\n"
+ + "encryptMetadata = " + encryptMetadata;
}
}