aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main
diff options
context:
space:
mode:
authoremusic <emina.music@egiz.gv.at>2018-01-18 17:36:08 +0100
committeremusic <emina.music@egiz.gv.at>2018-03-21 13:34:03 +0100
commit89f53d196e10a1874cd61e3ee42f57dfd77eb856 (patch)
treef3409f6ca4cb559571e00c8ed29895c2f10b7eb2 /pdf-as-lib/src/main
parentaf86c24f4f7cc81c5a4603cd8ee4fcaa0cee9eff (diff)
downloadpdf-as-4-89f53d196e10a1874cd61e3ee42f57dfd77eb856.tar.gz
pdf-as-4-89f53d196e10a1874cd61e3ee42f57dfd77eb856.tar.bz2
pdf-as-4-89f53d196e10a1874cd61e3ee42f57dfd77eb856.zip
protecting pdf file
# Conflicts: # pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
Diffstat (limited to 'pdf-as-lib/src/main')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java12
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java8
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/GlobalConfiguration.java18
3 files changed, 34 insertions, 4 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
index f8f71f2f..713948ba 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/IConfigurationConstants.java
@@ -108,12 +108,18 @@ public interface IConfigurationConstants {
public static final String BG_COLOR_DETECTION = "sigblock.placement.bgcolor.detection.enabled";
public static final String SIG_PLACEMENT_DEBUG_OUTPUT = "sigblock.placement.debug.file";
-
-
-
/**
* PADES Constants
*/
public static final String SIG_PADES_FORCE_FLAG= SIG_OBJECT + SEPERATOR+"PAdESCompatibility";
public static final String SIG_PADES_INTELL_FLAG = SIG_OBJECT + SEPERATOR+"CheckPAdESCompatibility";
+
+
+ /**
+ * Protect PDF file from copying content and extracting
+ */
+
+ public static final String DEFAULT_CONFIG_PROTECT_COPY_PDF = DEFAULT_CONFIG_PROTECT_PDF + SEPERATOR + "accessCopy";
+ public static final String DEFAULT_CONFIG_PROTECT_EXTRACT_PDF = DEFAULT_CONFIG_PROTECT_PDF + SEPERATOR + "canModify";
+
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java
index 72d182ed..c3c2b6fd 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java
@@ -61,6 +61,11 @@ import at.gv.egiz.pdfas.lib.impl.SignParameterImpl;
import at.gv.egiz.pdfas.lib.impl.VerifyParameterImpl;
import at.gv.egiz.pdfas.lib.impl.configuration.ConfigValidatorLoader;
+
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+
public class PdfAsFactory implements IConfigurationConstants {
private static final Logger logger = LoggerFactory
@@ -118,6 +123,9 @@ public class PdfAsFactory implements IConfigurationConstants {
// TODO: register ECCelerate in second position when TLS issue is
// fixed
registerProvider(new ECCelerate(), -1);
+
+ registerProvider( new BouncyCastleProvider(), -2);
+
} else {
logger.info("Skipping Security Provider registration!");
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/GlobalConfiguration.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/GlobalConfiguration.java
index d04f6878..a40c336d 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/GlobalConfiguration.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/GlobalConfiguration.java
@@ -21,6 +21,7 @@
* The "NOTICE" text file is part of the distribution. Any derivative works
* that you distribute must include a readable copy of the "NOTICE" text file.
******************************************************************************/
+
package at.gv.egiz.pdfas.lib.impl.configuration;
import at.gv.egiz.pdfas.common.settings.ISettings;
@@ -46,5 +47,20 @@ public class GlobalConfiguration extends SpecificBaseConfiguration
}
return null;
}
-
+
+ public String getDefaultCopyProtection() {
+ if(this.configuration.hasValue(DEFAULT_CONFIG_PROTECT_COPY_PDF)) {
+ return this.configuration.getValue(DEFAULT_CONFIG_PROTECT_COPY_PDF);
+ }
+ return null;
+ }
+
+ public String getDefaultExtractProtection() {
+ if(this.configuration.hasValue(DEFAULT_CONFIG_PROTECT_EXTRACT_PDF)) {
+ return this.configuration.getValue(DEFAULT_CONFIG_PROTECT_EXTRACT_PDF);
+ }
+ return null;
+ }
+
+
}