aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-12-15 11:54:14 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-12-15 11:54:14 +0000
commitc699751c11265ec9f00d093cbc3346b8a8ea1b0d (patch)
treec02f1a2e5f71cb9c8c96ea598c2d2af3a0bed7ec
parenta68a8a4122e62f22a44c79f904aef68a500bf9ca (diff)
downloadpdf-as-3-c699751c11265ec9f00d093cbc3346b8a8ea1b0d.tar.gz
pdf-as-3-c699751c11265ec9f00d093cbc3346b8a8ea1b0d.tar.bz2
pdf-as-3-c699751c11265ec9f00d093cbc3346b8a8ea1b0d.zip
Index for Adobe.PDF-AS Signatures adjusted
Configuration updates Minor bug (Configuration key for adobe sign field was adobeSignFieldName which did not match the key in the configuration) git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@519 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java4
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java31
-rw-r--r--work/cfg/config.properties44
3 files changed, 63 insertions, 16 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java b/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java
index 4fec0a1..122aec8 100644
--- a/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java
+++ b/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java
@@ -3,6 +3,8 @@
*/
package at.gv.egiz.pdfas.api.commons;
+import at.knowcenter.wag.egov.egiz.pdf.AdobeSignatureHelper;
+
/**
* Contains commonly used constants.
*
@@ -112,6 +114,8 @@ public final class Constants
public static final String TEMP_DIR_NAME = "pdfastmp";
public static final String BKU_HEADER_SIGNATURE_LAYOUT = "SignatureLayout";
+
+ public static final String ADOBE_SIG_FILTER = AdobeSignatureHelper.ADOBE_SIG_FILTER;
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java
index 6a7c545..9a52a84 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java
@@ -1,12 +1,14 @@
package at.knowcenter.wag.egov.egiz.pdf;
import java.util.HashMap;
+import java.util.Iterator;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.apache.log4j.Logger;
+import at.gv.egiz.pdfas.api.commons.Constants;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.gv.egiz.pdfas.framework.signator.SignatorInformation;
import at.gv.egiz.pdfas.utils.OgnlUtil;
@@ -16,9 +18,11 @@ import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
import com.lowagie.text.Rectangle;
+import com.lowagie.text.pdf.AcroFields;
import com.lowagie.text.pdf.PdfDate;
import com.lowagie.text.pdf.PdfDictionary;
import com.lowagie.text.pdf.PdfName;
+import com.lowagie.text.pdf.PdfObject;
import com.lowagie.text.pdf.PdfSignature;
import com.lowagie.text.pdf.PdfSignatureAppearance;
import com.lowagie.text.pdf.PdfStamper;
@@ -31,7 +35,7 @@ import com.lowagie.text.pdf.PdfString;
*
*/
public class AdobeSignatureHelper {
- private static final String ADOBE_SIGN_FIELDNAME_KEY = "adobeSignFieldName";
+ private static final String ADOBE_SIGN_FIELDNAME_KEY = "adobeSignFieldValue";
private static final String ADOBE_SIG_ENABLED_KEY = "adobeSignEnabled";
@@ -54,17 +58,36 @@ public class AdobeSignatureHelper {
SignatureObject so, ActualTablePos atp) throws PresentableException {
try {
- logger.info("create adobe signature field");
+ logger.debug("Creating adobe signature field.");
PdfSignatureAppearance sap = stamper.getSignatureAppearance();
String fieldName = getAdobeFieldName(so.getSignatureTypeDefinition().getType());
// find field num
+ /*
int nexSigNum = 1;
String finalFieldName = fieldName + " #" + nexSigNum;
+
while (stamper.getAcroFields().getField(finalFieldName) != null) {
nexSigNum++;
finalFieldName = fieldName + " #" + nexSigNum;
}
+ */
+
+ AcroFields af = stamper.getAcroFields();
+ Iterator signatureNamesIt = af.getSignatureNames().iterator();
+ PdfName referenceFilterName = new PdfName(ADOBE_SIG_FILTER);
+ int nextSigNum = 1;
+ while (signatureNamesIt.hasNext()) {
+ PdfDictionary dictionary = (PdfDictionary) af.getSignatureDictionary((String) signatureNamesIt.next());
+ PdfObject filterName = dictionary.get(PdfName.FILTER);
+ if (filterName != null && filterName.isName()) {
+ PdfName name = (PdfName) filterName;
+ if (referenceFilterName.equals(name)) {
+ nextSigNum++;
+ }
+ }
+ }
+ String finalFieldName = fieldName + " #" + nextSigNum;
sap.setCrypto(null, null, null, null);
// supress overlay text for visible signatures
@@ -88,11 +111,15 @@ public class AdobeSignatureHelper {
// sig.setReason("reason is not visible");
// sig.setContact("contact is not visible");
// sig.setDate(new PdfDate());
+
+ /* disabled in order to align adobe signature appearance for textual signatures with binary signatures
if (si != null) {
XMLGregorianCalendar c = DatatypeFactory.newInstance().newXMLGregorianCalendar(
si.getSignSignatureObject().date);
sig.setDate(new PdfDate(c.toGregorianCalendar()));
}
+ */
+
sig.setName(getAdobeSignText(so.getSignatureTypeDefinition().getType(), si));
sap.setCryptoDictionary(sig);
diff --git a/work/cfg/config.properties b/work/cfg/config.properties
index c56311c..cf90df8 100644
--- a/work/cfg/config.properties
+++ b/work/cfg/config.properties
@@ -7,8 +7,6 @@
#############################################
# Applikationseinstellungen
-#i#normalizer.version=V01
-
ldap.url=http://xxx.yyy.z.com:5000/some/fake/url
# time frame the signing time may differ (in the upper and the lower direction) from the host time
@@ -167,14 +165,17 @@ default.SIG_BAIK_ENABLED=false
# enable/disable additional creation of adobe signature field
default.adobeSignEnabled=true
-# title values for adobe signature field. Can be overwritten per signature profile.
-# e.g. sig_obj.SIGNATURBLOCK_DE.adobeSignText.binary=Mein Signator
+# default name for adobe signatures (binary)
default.adobeSignText.binary=PDF-AS
-# ognl use for textual signature is ok, not for binary!
-default.adobeSignText.textual=${sso.certSubjectDNPart("CN")}
+
+# default name for adobe signatures (textual)
+# ognl can be used for textual signatures only
+#default.adobeSignText.textual=${sso.certSubjectDNPart("CN")}
+default.adobeSignText.textual=PDF-AS
# default name of the adobe signature field (if enabled).
-default.adobeSignFieldValue=PDF-AS-Signatur
+#default.adobeSignFieldValue=PDF-AS Signatur
+default.adobeSignFieldValue=PDF-AS Signatur
#absolute positioning
@@ -203,6 +204,7 @@ sig_obj.AMTSSIGNATURBLOCK_DE.key.SIG_META=Prüfinformation
sig_obj.AMTSSIGNATURBLOCK_DE.key.SIG_NOTE=Hinweis
sig_obj.AMTSSIGNATURBLOCK_DE.pos=f:80
+sig_obj.AMTSSIGNATURBLOCK_DE.adobeSignFieldValue=PDF-AS Signatur
sig_obj.AMTSSIGNATURBLOCK_DE.value.SIG_SUBJECT=Max Mustermann
sig_obj.AMTSSIGNATURBLOCK_DE.value.SIG_META=Informationen zur Prüfung der elektronischen Signatur und des Ausdrucks finden Sie unter: https://www.signaturpruefung.gv.at
@@ -250,6 +252,7 @@ sig_obj.AMTSSIGNATURBLOCK_EN.key.SIG_META=Verification
sig_obj.AMTSSIGNATURBLOCK_EN.key.SIG_NOTE=Note
sig_obj.AMTSSIGNATURBLOCK_EN.pos=f:80
+sig_obj.AMTSSIGNATURBLOCK_EN.adobeSignFieldValue=PDF-AS Signature
sig_obj.AMTSSIGNATURBLOCK_EN.value.SIG_SUBJECT=Max Mustermann
sig_obj.AMTSSIGNATURBLOCK_EN.value.SIG_META=Information about the verification of the electronic signature and of the printout can be found at: https://www.signature-verification.gv.at
@@ -296,6 +299,7 @@ sig_obj.SIGNATURBLOCK_DE.key.SIG_ID=Parameter
sig_obj.SIGNATURBLOCK_DE.key.SIG_META=Prüfinformation
sig_obj.SIGNATURBLOCK_DE.pos=f:80
+sig_obj.SIGNATURBLOCK_DE.adobeSignFieldValue=PDF-AS Signatur
sig_obj.SIGNATURBLOCK_DE.value.SIG_META=Informationen zur Prüfung der elektronischen Signatur und des Ausdrucks finden Sie unter: https://www.signaturpruefung.gv.at
sig_obj.SIGNATURBLOCK_DE.value.SIG_LABEL=./images/signatur-logo_de.png
@@ -342,6 +346,7 @@ sig_obj.SIGNATURBLOCK_DE_PDFA.key.SIG_ID=Parameter
sig_obj.SIGNATURBLOCK_DE_PDFA.key.SIG_META=Prüfinformation
sig_obj.SIGNATURBLOCK_DE_PDFA.pos=f:80
+sig_obj.SIGNATURBLOCK_DE_PDFA.adobeSignFieldValue=PDF-AS Signatur
sig_obj.SIGNATURBLOCK_DE_PDFA.value.SIG_META=Informationen zur Prüfung der elektronischen Signatur und des Ausdrucks finden Sie unter: https://www.signaturpruefung.gv.at
sig_obj.SIGNATURBLOCK_DE_PDFA.value.SIG_LABEL=./images/signatur-logo_de.png
@@ -380,6 +385,7 @@ sig_obj.SIGNATURBLOCK_MINIMAL_DE.value.SIG_META=Informationen zur Prüfung der el
sig_obj.SIGNATURBLOCK_MINIMAL_DE.value.SIG_LABEL=./images/signatur-logo_de.png
sig_obj.SIGNATURBLOCK_MINIMAL_DE.pos=w:230.0;f:80
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.adobeSignFieldValue=PDF-AS Signatur
#---------------------- MAIN TABLE -------------------------
sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.1=SIG_LABEL-i
@@ -408,6 +414,7 @@ sig_obj.SIGNATURBLOCK_MINIMAL_EN.value.SIG_META=Information about the verificati
sig_obj.SIGNATURBLOCK_MINIMAL_EN.value.SIG_LABEL=./images/signatur-logo_en.png
sig_obj.SIGNATURBLOCK_MINIMAL_EN.pos=w:230.0;f:80
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.adobeSignFieldValue=PDF-AS Signature
#---------------------- MAIN TABLE -------------------------
sig_obj.SIGNATURBLOCK_MINIMAL_EN.table.main.1=SIG_LABEL-i
@@ -441,6 +448,7 @@ sig_obj.SIGNATURBLOCK_EN.key.SIG_ID=Parameter
sig_obj.SIGNATURBLOCK_EN.key.SIG_META=Verification
sig_obj.SIGNATURBLOCK_EN.pos=f:80
+sig_obj.SIGNATURBLOCK_EN.adobeSignFieldValue=PDF-AS Signature
sig_obj.SIGNATURBLOCK_EN.value.SIG_META=Information about the verification of the electronic signature and of the printout can be found at: https://www.signature-verification.gv.at
sig_obj.SIGNATURBLOCK_EN.value.SIG_LABEL=./images/signatur-logo_en.png
@@ -486,6 +494,8 @@ sig_obj.INVISIBLE.table.main.Style.border=0
# scaling of image (in pdf units)
sig_obj.INVISIBLE.table.main.Style.imagescaletofit=0.0;0.0
+sig_obj.INVISIBLE.adobeSignFieldValue=PDF-AS Signatur
+
###################################################################################################
# PROFIL: BAIK Archivsignatur
@@ -509,11 +519,15 @@ sig_obj.BAIK_ARCHIV_SIGNATUR.key.SIG_META=Hinweis
sig_obj.BAIK_ARCHIV_SIGNATUR.key.SIG_TITLE=ELEKTRONISCHE ARCHIVSIGNATUR
sig_obj.BAIK_ARCHIV_SIGNATUR.pos=f:80
+sig_obj.BAIK_ARCHIV_SIGNATUR.adobeSignFieldValue=ELEKTRONISCHE ARCHIVSIGNATUR
-sig_obj.BAIK_ARCHIV_SIGNATUR.value.SIG_META=Dokumentformat: ${iui.pdfVersion}
+sig_obj.BAIK_ARCHIV_SIGNATUR.value.SIG_META=Dokumentenformat: ${iui.pdfVersion}
sig_obj.BAIK_ARCHIV_SIGNATUR.value.SIG_LABEL=./images/Baik_Archiv.gif
sig_obj.BAIK_ARCHIV_SIGNATUR.value.SIG_TITLE=ELEKTRONISCHE ARCHIVSIGNATUR
+sig_obj.BAIK_ARCHIV_SIGNATUR.adobeSignFieldValue=Archivsignatur
+sig_obj.BAIK_ARCHIV_SIGNATUR.adobeSignText.binary=Archivsignatur der BAIK
+
sig_obj.BAIK_ARCHIV_SIGNATUR.phlength.SIG_META=50
sig_obj.BAIK_ARCHIV_SIGNATUR.value.SIG_SIG_LABEL=BAIK-Archiv\n\nUrkundenarchiv der Bundeskammer für Architekten und Ingenieurskonsulenten
@@ -550,8 +564,6 @@ sig_obj.BAIK_ARCHIV_SIGNATUR.table.info.6=SIG_KZ-cv
###################################################################################################
# PROFIL: BAIK Beurkundungssignatur
-sig_obj.BAIK_URKUNDE_SIGNATUR.pos=f:80
-
sig_obj.BAIK_URKUNDE_SIGNATUR.description=BAIK Beurkundungssignatur
# enable/disable BAIK support for this profile
@@ -569,16 +581,18 @@ sig_obj.BAIK_URKUNDE_SIGNATUR.key.SIG_KZ=Methode
sig_obj.BAIK_URKUNDE_SIGNATUR.key.SIG_META=Hinweis
sig_obj.BAIK_URKUNDE_SIGNATUR.key.SIG_TITLE=ELEKTRONISCHE BEURKUNDUNGSSIGNATUR
-sig_obj.BAIK_URKUNDE_SIGNATUR.value.SIG_META=Dokumentformat: ${iui.pdfVersion}
+sig_obj.BAIK_URKUNDE_SIGNATUR.pos=f:80
+sig_obj.BAIK_URKUNDE_SIGNATUR.adobeSignFieldValue=Urkundensignatur
+sig_obj.BAIK_URKUNDE_SIGNATUR.adobeSignText.binary=Urkundensignatur der BAIK
+
+sig_obj.BAIK_URKUNDE_SIGNATUR.value.SIG_META=Dokumentenformat: ${iui.pdfVersion}
sig_obj.BAIK_URKUNDE_SIGNATUR.value.SIG_LABEL=./images/Baik_Urkunde.gif
sig_obj.BAIK_URKUNDE_SIGNATUR.value.SIG_TITLE=ELEKTRONISCHE BEURKUNDUNGSSIGNATUR
-
-
sig_obj.BAIK_URKUNDE_SIGNATUR.phlength.SIG_META=50
sig_obj.BAIK_URKUNDE_SIGNATUR.phlength.SIG_SIG_LABEL=200
-sig_obj.BAIK_URKUNDE_SIGNATUR.value.SIG_SIG_LABEL=${sso.certSubjectDNPart("CN")}, ${sso.certSubjectDNPart("O")}, Kanzleisitz: ${sso.certSubjectDNPart("L")}
+sig_obj.BAIK_URKUNDE_SIGNATUR.value.SIG_SIG_LABEL=${sso.certSubjectDNPart("CN")}, ${sso.certSubjectDNPart("O")}${sso.certSubjectDNPart("L") != null ? (", Kanzleisitz: " + sso.certSubjectDNPart("L")) : ""}
#---------------------- MAIN TABLE -------------------------
sig_obj.BAIK_URKUNDE_SIGNATUR.table.main.1=SIG_TITLE-v
@@ -606,6 +620,8 @@ sig_obj.BAIK_URKUNDE_SIGNATUR.table.info.5=SIG_ALG-cv
sig_obj.BAIK_URKUNDE_SIGNATUR.table.info.6=SIG_KZ-cv
+
+
#############################################
# start additional LDAP-Mappings
# note: ldap_mapping.xxx.serial_attr may be omitted if value is "eidCertificateSerialNumber"