aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbschnalzer <bianca.schnalzer@egiz.gv.at>2017-12-11 14:33:24 +0100
committerbschnalzer <bianca.schnalzer@egiz.gv.at>2017-12-11 14:33:24 +0100
commita9fb8ac7fa73d2908735d8016609e15c954bcbdf (patch)
tree4450a14778e1032444a5e18592b4d4c67f011b74
parent38c6ea7e6014f800a87c72f7bf830a7b4397cbf3 (diff)
downloadpdf-as-4-a9fb8ac7fa73d2908735d8016609e15c954bcbdf.tar.gz
pdf-as-4-a9fb8ac7fa73d2908735d8016609e15c954bcbdf.tar.bz2
pdf-as-4-a9fb8ac7fa73d2908735d8016609e15c954bcbdf.zip
ProtectPDF, PDFA
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java1
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java21
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderData.java3
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java7
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java51
-rw-r--r--pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java2
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java4
-rw-r--r--pdf-as-web/src/main/webapp/assets/img/mobileBKU.pngbin9742 -> 6269 bytes
-rw-r--r--pdf-as-web/src/main/webapp/assets/img/mobileBKU_alt.pngbin0 -> 9742 bytes
-rw-r--r--pdf-as-web/src/main/webapp/assets/img/onlineBKU_alt.png (renamed from pdf-as-web/src/main/webapp/assets/img/onlineBKU.png)bin6650 -> 6650 bytes
10 files changed, 49 insertions, 40 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
index e8cdd955..c19b7b10 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
@@ -372,6 +372,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants,
logger.info("ByteRange: " + sb.toString());
+
request.setSignatureData(signatureDataExtractor
.getSignatureData());
request.setByteRange(byteRange);
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java
index 6e91e808..b20215fc 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/PlaceholderConfiguration.java
@@ -24,27 +24,16 @@
package at.gv.egiz.pdfas.lib.impl.configuration;
import at.gv.egiz.pdfas.common.settings.ISettings;
-import at.gv.egiz.pdfas.common.settings.Profiles;
-import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings;
-import at.gv.egiz.pdfas.lib.api.Configuration;
import at.gv.egiz.pdfas.lib.api.IConfigurationConstants;
-import at.gv.egiz.pdfas.lib.api.PdfAs;
-import at.gv.egiz.pdfas.lib.impl.PdfAsImpl;
-import at.gv.egiz.pdfas.lib.impl.PdfAsParameterImpl;
-import at.gv.egiz.pdfas.lib.impl.placeholder.SignaturePlaceholderData;
-import at.gv.egiz.pdfas.lib.impl.status.OperationStatus;
-import at.gv.egiz.pdfas.lib.settings.Settings;
-import at.gv.egiz.pdfas.lib.util.SignatureUtils;
-import at.gv.egiz.pdfas.lib.api.PdfAs;
-import com.sun.corba.se.spi.orb.Operation;
-
-import java.security.Signature;
-import java.util.Properties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class PlaceholderConfiguration extends SpecificBaseConfiguration
implements IConfigurationConstants {
+ private static final Logger logger = LoggerFactory.getLogger(PlaceholderConfiguration.class);
+
public PlaceholderConfiguration(ISettings configuration) {
super(configuration);
}
@@ -67,10 +56,12 @@ public class PlaceholderConfiguration extends SpecificBaseConfiguration
*/
public boolean isProfileConfigurationEnabled(String selectedProfileID)
{
+ logger.info("SelectedProfileID in ProfileConfEnabled: "+selectedProfileID);
String profileMatch = SIG_OBJECT+SEPERATOR+selectedProfileID+SEPERATOR+PLACEHOLDER_SEARCH_ENABLED;
if (configuration.hasValue(profileMatch)) {
String value = configuration.getValue(profileMatch);
if (value.equalsIgnoreCase(TRUE)) {
+ logger.info("Configuration has Value: "+value);
return true;
}
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderData.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderData.java
index cf0ad149..3dbedee5 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderData.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderData.java
@@ -54,7 +54,8 @@ import at.knowcenter.wag.egov.egiz.pdf.TablePos;
* @author exthex
*
*/
-public class SignaturePlaceholderData {
+public class
+SignaturePlaceholderData {
public static final String ID_KEY = "id";
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java
index a3af957d..e2fa7062 100644
--- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java
+++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/table/Style.java
@@ -49,6 +49,10 @@
package at.knowcenter.wag.egov.egiz.table;
import java.awt.Color;
+import java.awt.color.ColorSpace;
+import java.awt.color.ICC_ColorSpace;
+import java.awt.color.ICC_Profile;
+import java.awt.color.ICC_ProfileRGB;
import java.io.Serializable;
/**
@@ -505,7 +509,7 @@ public class Style implements Serializable {
/**
* Sets the scaleToFit dimensions to be applied for image-cells.
- * @param imageScaleToFit_ The scaleToFit dimensions to be applied for image-cells.
+ * @param imageScaleToFit The scaleToFit dimensions to be applied for image-cells.
*/
public void setImageScaleToFit(ImageScaleToFit imageScaleToFit)
{
@@ -531,7 +535,6 @@ public class Style implements Serializable {
*
* @param baseStyle the style object that serves as a primary style source.
* @param inheritStyle the style object that serves as a secondary style source in case a style attribute is not defined on the primary style source.
- * @param isValue
* @return Returns a new Style object being fully equipped with styles.
*/
public static Style doInherit(Style baseStyle, Style inheritStyle) {
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
index 090986a5..e27597d1 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java
@@ -24,6 +24,7 @@
package at.gv.egiz.pdfas.lib.impl.signing.pdfbox2;
import at.gv.egiz.pdfas.lib.api.Configuration;
+import at.gv.egiz.pdfas.lib.util.PDDocumentUtil;
import iaik.x509.X509Certificate;
import java.awt.Graphics2D;
@@ -602,7 +603,6 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
- /*/ Check if document should be protected*/
synchronized (doc) {
doc.saveIncremental(bos);
@@ -612,6 +612,38 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
}
+
+ /*/ Check if document should be protected*/
+ //Check if doc has to be protected//
+ if (requestedSignature.getStatus().getSettings().hasValue(DEFAULT_CONFIG_PROTECT_PDF)) {
+ //TODO: Test and Check ProtectionSettings// --> overwritten DefaultSecHandler and PDDocumentUtil
+ if (IConfigurationConstants.TRUE.equalsIgnoreCase(requestedSignature.getStatus().getSettings().getValue(IConfigurationConstants.DEFAULT_CONFIG_PROTECT_PDF)))
+ { //Protect document before setting output
+ //Policies for docs
+ AccessPermission ap = doc.getCurrentAccessPermission();
+ ap.setCanModify(false);
+ ap.setCanExtractForAccessibility(false);
+ ap.setCanAssembleDocument(false);
+ ap.setCanExtractContent(false);
+ //StandardProtectionPolicy spp = new StandardProtectionPolicy("", "", ap);
+ //doc = PDDocument.load(pdfObject.getSignedDocument(), spp.getOwnerPassword());
+ //PDDocumentUtil docProtected = new PDDocumentUtil();
+ //docProtected.protect(spp);
+
+ //TODO Save File Settings to signed document//
+ //Byte-Array and PDF-File//
+ //doc = docProtected;
+ //doc.close();
+
+ logger.info("Added Protection Parameters");
+
+ }
+
+ }
+
+
+
+
/*
Check if resulting pdf is PDF-A conform
*/
@@ -619,23 +651,6 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
runPDFAPreflight(new ByteArrayDataSource(pdfObject.getSignedDocument()));
}
- /*Check if doc has to be protected*/
- /* if (requestedSignature.getStatus().getSettings().hasValue(DEFAULT_CONFIG_PROTECT_PDF)) {
- if (IConfigurationConstants.TRUE.equalsIgnoreCase(requestedSignature.getStatus().getSettings().getValue(IConfigurationConstants.DEFAULT_CONFIG_PROTECT_PDF)))
- { //Protect document before setting output
- //Policies for docs
- AccessPermission ap = doc.getCurrentAccessPermission();
- ap.setReadOnly();
- ap.setCanModify(false);
- ap.setCanExtractForAccessibility(false);
- doc = new PDDocument(doc.getDocument(),null,ap);
- logger.info("Added Protection Parameters");
- }
-
- }
-*/
-
-
} catch (IOException e1) {
e1.printStackTrace();
}
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java
index 17ee60be..bb692f06 100644
--- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java
+++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java
@@ -157,7 +157,7 @@ public class PDFBoxTable {
padding = style.getPadding();
bgColor = style.getBgColor();
-
+
try {
normalizeContent(abstractTable);
} catch (PdfAsException e) {
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
index 0dc17c08..3aad831d 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
@@ -504,10 +504,8 @@ public class PdfAsHelper {
/**
* Create synchronous PDF Signature
*
- * @param request
+ * @param params
* The Web request
- * @param response
- * The Web response
* @param pdfData
* The pdf data
* @return The signed pdf data
diff --git a/pdf-as-web/src/main/webapp/assets/img/mobileBKU.png b/pdf-as-web/src/main/webapp/assets/img/mobileBKU.png
index 48e77934..daa8fa3f 100644
--- a/pdf-as-web/src/main/webapp/assets/img/mobileBKU.png
+++ b/pdf-as-web/src/main/webapp/assets/img/mobileBKU.png
Binary files differ
diff --git a/pdf-as-web/src/main/webapp/assets/img/mobileBKU_alt.png b/pdf-as-web/src/main/webapp/assets/img/mobileBKU_alt.png
new file mode 100644
index 00000000..48e77934
--- /dev/null
+++ b/pdf-as-web/src/main/webapp/assets/img/mobileBKU_alt.png
Binary files differ
diff --git a/pdf-as-web/src/main/webapp/assets/img/onlineBKU.png b/pdf-as-web/src/main/webapp/assets/img/onlineBKU_alt.png
index 2ec41892..2ec41892 100644
--- a/pdf-as-web/src/main/webapp/assets/img/onlineBKU.png
+++ b/pdf-as-web/src/main/webapp/assets/img/onlineBKU_alt.png
Binary files differ