aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/at/gv/egiz/pdfas/test/APITest.java65
-rw-r--r--src/main/java/at/gv/egiz/pdfas/test/JarExtractTest.java28
-rw-r--r--src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java47
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java2
-rw-r--r--src/main/webapp/WEB-INF/web.xml2
-rw-r--r--src/site/changes.xml4
-rw-r--r--work/cfg/config.properties70
-rw-r--r--work/cfg/log4j.properties2
-rw-r--r--work/images/signatur-logo_de.pngbin62345 -> 61580 bytes
-rw-r--r--work/images/signatur-logo_en.pngbin61344 -> 60542 bytes
11 files changed, 210 insertions, 12 deletions
diff --git a/pom.xml b/pom.xml
index e0f16fc..87f742a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
<groupId>knowcenter</groupId>
<artifactId>pdf-as</artifactId>
<name>PDF-AS</name>
- <version>3.0.5-20080611</version>
+ <version>3.0.5-20080612</version>
<!-- don't forget to set the version string at.knowcenter.wag.egov.egiz.PdfAS.PDFAS_VERSION accordingly -->
<description>Amtssignatur fuer elektronische Aktenfuehrung</description>
diff --git a/src/main/java/at/gv/egiz/pdfas/test/APITest.java b/src/main/java/at/gv/egiz/pdfas/test/APITest.java
new file mode 100644
index 0000000..9e52a41
--- /dev/null
+++ b/src/main/java/at/gv/egiz/pdfas/test/APITest.java
@@ -0,0 +1,65 @@
+package at.gv.egiz.pdfas.test;
+
+import java.io.File;
+import java.io.IOException;
+
+import at.gv.egiz.pdfas.PdfAsFactory;
+import at.gv.egiz.pdfas.api.PdfAs;
+import at.gv.egiz.pdfas.api.commons.Constants;
+import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
+import at.gv.egiz.pdfas.api.io.DataSource;
+import at.gv.egiz.pdfas.api.sign.SignParameters;
+import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning;
+import at.gv.egiz.pdfas.io.FileBasedDataSink;
+import at.gv.egiz.pdfas.io.FileBasedDataSource;
+
+public final class APITest {
+
+ private APITest() {
+ }
+
+ public static void main(String[] args) {
+ File configdir = new File("D:/downloads/testpdfas");
+ File unsignedFile = new File("./test-files/blindtext.pdf");
+ File signedFile = new File("d:/temp/blindtext_signed.pdf");
+ String signatureMode = Constants.SIGNATURE_TYPE_BINARY;
+ String signatureDevice = Constants.SIGNATURE_DEVICE_MOA;
+ String signatureProfile = "SIGNATURBLOCK_MINIMAL_DE";
+ SignaturePositioning signaturePos = null;
+
+ PdfAs pdfasAPI = null;
+
+ try {
+
+ // instantiate api
+ pdfasAPI = PdfAsFactory.createPdfAs(configdir);
+
+ // set source
+ DataSource dataSource = new FileBasedDataSource(unsignedFile, "application/pdf");
+
+ // set output
+ FileBasedDataSink dataSink = new FileBasedDataSink(signedFile);
+
+ // configure signature
+ SignParameters signParameters = new SignParameters();
+ signParameters.setDocument(dataSource);
+ signParameters.setOutput(dataSink);
+ signParameters.setSignatureType(signatureMode);
+ signParameters.setSignatureDevice(signatureDevice);
+ signParameters.setSignatureProfileId(signatureProfile);
+ signParameters.setSignaturePositioning(signaturePos);
+
+ // sign
+ pdfasAPI.sign(signParameters);
+
+ System.out.println("Successfully signed.");
+
+ } catch (PdfAsException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}
diff --git a/src/main/java/at/gv/egiz/pdfas/test/JarExtractTest.java b/src/main/java/at/gv/egiz/pdfas/test/JarExtractTest.java
new file mode 100644
index 0000000..e567452
--- /dev/null
+++ b/src/main/java/at/gv/egiz/pdfas/test/JarExtractTest.java
@@ -0,0 +1,28 @@
+package at.gv.egiz.pdfas.test;
+
+import at.gv.egiz.pdfas.api.commons.Constants;
+import at.gv.egiz.pdfas.utils.ConfigUtils;
+
+public final class JarExtractTest {
+
+ private JarExtractTest() {
+ }
+
+ public static void main(String[] args) {
+ try {
+
+ String sysProp = System.getProperty(Constants.CONFIG_DIR_SYSTEM_PROPERTY);
+ System.out.println("System property \"" + Constants.CONFIG_DIR_SYSTEM_PROPERTY + "\" = " + (sysProp != null ? ("\"" + sysProp + "\"") : null));
+
+ String deployedTo = ConfigUtils.deployDefaultConfiguration();
+ if (deployedTo != null) {
+ System.out.println("Configuration successfully deployed to \"" + deployedTo + "\".");
+ } else {
+ System.out.println("Configuration was NOT deployed. Maybe a configuration already exists.");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java b/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java
index 627e611..a7bca3f 100644
--- a/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java
+++ b/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java
@@ -71,9 +71,11 @@ public final class ConfigUtils {
*/
private static boolean deployFromZIP(String destination, boolean overwriteExisting) throws ConfigUtilsException {
try {
- File destinationFolder = new File(destination);
- if (destinationFolder.exists() && !overwriteExisting) {
- return false;
+ if (!overwriteExisting) {
+ if (configurationAlreadyExists(destination)) {
+ logger_.debug("There is at least one file or folder that would be overwritten at destination path \"" + destination + "\". Skipping extraction.");
+ return false;
+ }
}
InputStream in = ConfigUtils.class.getClassLoader().getResourceAsStream(Constants.DEFAULT_CONFIGURATION_ZIP_RESOURCE);
if (in == null) {
@@ -81,6 +83,7 @@ public final class ConfigUtils {
}
ZipInputStream zis = new ZipInputStream(in);
ZipEntry ze;
+ File destinationFolder = new File(destination);
destinationFolder.mkdirs();
logger_.debug("Extracting default configuration to folder \"" + destinationFolder.getCanonicalPath() + "\".");
while ((ze = zis.getNextEntry()) != null) {
@@ -102,6 +105,44 @@ public final class ConfigUtils {
}
}
+ private static boolean configurationAlreadyExists(String destination) throws ConfigUtilsException, IOException {
+ logger_.debug("Checking configuration \"" + destination + "\" already exists (resp. if there are any directories or files that would be overwritten).");
+ File destinationFolder = new File(destination);
+ if (destinationFolder == null || !destinationFolder.exists()) {
+ return false;
+ }
+ InputStream in = ConfigUtils.class.getClassLoader().getResourceAsStream(Constants.DEFAULT_CONFIGURATION_ZIP_RESOURCE);
+ if (in == null) {
+ throw new ConfigUtilsException("Unable to find default configuration resource \"" + Constants.DEFAULT_CONFIGURATION_ZIP_RESOURCE + "\".");
+ }
+ ZipInputStream zis = new ZipInputStream(in);
+ ZipEntry ze;
+ while ((ze = zis.getNextEntry()) != null) {
+ if (ze.isDirectory()) {
+ File newFolder = new File(destinationFolder, ze.getName());
+ logger_.debug("Checking if folder \"" + newFolder.getPath() + "\" already exists.");
+ if (newFolder.exists()) {
+ logger_.debug("YES !");
+ return true;
+ } else {
+ logger_.debug("no");
+ }
+ } else {
+ File destFile = new File(destinationFolder, ze.getName());
+ logger_.trace("Checking if file \"" + destFile.getName() + "\" already exists.");
+ if (destFile.exists()) {
+ logger_.trace("YES !");
+ return true;
+ } else {
+ logger_.trace("no");
+ }
+ }
+ zis.closeEntry();
+ }
+ zis.close();
+ return false;
+ }
+
/**
* Deploys the default configuration to the given destination folder.
*
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
index f6b74be..1b4a210 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
@@ -96,7 +96,7 @@ public abstract class PdfAS
* The current version of the pdf-as library. This version string is logged on every invocation
* of the api or the web application.
*/
- public static final String PDFAS_VERSION = "3.0.5-20080611";
+ public static final String PDFAS_VERSION = "3.0.5-20080612";
/**
* The key of the strict mode setting.
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index 6d675b4..2bcbdd2 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -127,7 +127,7 @@
</servlet-mapping>
<session-config>
- <session-timeout>30</session-timeout>
+ <session-timeout>10</session-timeout>
</session-config>
<welcome-file-list>
diff --git a/src/site/changes.xml b/src/site/changes.xml
index fc2b488..dc2183b 100644
--- a/src/site/changes.xml
+++ b/src/site/changes.xml
@@ -13,6 +13,10 @@
</release>
-->
+ <release version="3.0.5" date="2008-06-12" description="subsequent release">
+ <action dev="tknall" type="update">A new check for the existence of a configuration has been implemented. The extraction is skipped if any files or folders would be overwritten. Files like log- or temp-files may exist and do not prevent the deployment of the default configuration.</action>
+ </release>
+
<release version="3.0.5" date="2008-06-11" description="subsequent release">
<action dev="tknall" type="fix">Serious bug solved. Method storeCertificate tried to fetch a certificate from store before storing it. If not found (within the store resp. via ldap) the certificate was not stored!!!</action>
</release>
diff --git a/work/cfg/config.properties b/work/cfg/config.properties
index fe9b747..e5b4528 100644
--- a/work/cfg/config.properties
+++ b/work/cfg/config.properties
@@ -125,7 +125,7 @@ moa.sign.request.detached=./templates/default.moa.sign.detached.xml
# MOA Verifying
moa.verify.url=http://localhost:8080/moa-spss/services/SignatureVerification
-moa.verify.TrustProfileID=Test-Signaturdienste
+moa.verify.TrustProfileID=SecureSignature
# default moa enveloping verify template files
moa.verify.request.base64=./templates/default.moa.verify.request.enveloping.xml
@@ -173,6 +173,8 @@ sig_obj.types.AMTSSIGNATURBLOCK_DE=off
sig_obj.types.AMTSSIGNATURBLOCK_EN=off
sig_obj.types.SIGNATURBLOCK_DE=on
sig_obj.types.SIGNATURBLOCK_EN=on
+sig_obj.types.SIGNATURBLOCK_MINIMAL_DE=on
+sig_obj.types.SIGNATURBLOCK_MINIMAL_EN=on
#############################################
@@ -186,6 +188,16 @@ defaults.phlength.SIG_ID=70
defaults.phlength.SIG_NAME=130
+#absolute positioning
+#sig_obj.PROFIL.pos=p:1;x:40.0;y:800.0;w:400.0
+
+# font definition: face,height,weight
+# default_font: HELVETICA,8,NORMAL
+# font_face: HELVETICA | TIMES_ROMAN | COURIER
+# font_height: float value
+# font_weight: NORMAL | BOLD | ITALIC | BOLDITALIC | UNDERLINE | STRIKETHRU
+
+
###################################################################################################
# PROFIL: Amtssignaturblock (Deutsch)
@@ -213,7 +225,7 @@ sig_obj.AMTSSIGNATURBLOCK_DE.table.main.3=SIG_META-cv
sig_obj.AMTSSIGNATURBLOCK_DE.table.main.4=SIG_NOTE-cv
sig_obj.AMTSSIGNATURBLOCK_DE.table.main.ColsWidth=1 5
-sig_obj.AMTSSIGNATURBLOCK_DE.table.main.Style.bgcolor=245 245 240
+sig_obj.AMTSSIGNATURBLOCK_DE.table.main.Style.bgcolor=255 255 255
sig_obj.AMTSSIGNATURBLOCK_DE.table.main.Style.padding=3
sig_obj.AMTSSIGNATURBLOCK_DE.table.main.Style.border=0.1
sig_obj.AMTSSIGNATURBLOCK_DE.table.main.Style.halign=left
@@ -258,7 +270,7 @@ sig_obj.AMTSSIGNATURBLOCK_EN.table.main.3=SIG_META-cv
sig_obj.AMTSSIGNATURBLOCK_EN.table.main.4=SIG_NOTE-cv
sig_obj.AMTSSIGNATURBLOCK_EN.table.main.ColsWidth=1 5
-sig_obj.AMTSSIGNATURBLOCK_EN.table.main.Style.bgcolor=245 245 240
+sig_obj.AMTSSIGNATURBLOCK_EN.table.main.Style.bgcolor=255 255 255
sig_obj.AMTSSIGNATURBLOCK_EN.table.main.Style.padding=3
sig_obj.AMTSSIGNATURBLOCK_EN.table.main.Style.border=0.1
sig_obj.AMTSSIGNATURBLOCK_EN.table.main.Style.halign=left
@@ -299,7 +311,7 @@ sig_obj.SIGNATURBLOCK_DE.table.main.2=SIG_LABEL-i|TABLE-info
sig_obj.SIGNATURBLOCK_DE.table.main.3=SIG_META-cv
sig_obj.SIGNATURBLOCK_DE.table.main.ColsWidth=1 5
-sig_obj.SIGNATURBLOCK_DE.table.main.Style.bgcolor=245 245 240
+sig_obj.SIGNATURBLOCK_DE.table.main.Style.bgcolor=255 255 255
sig_obj.SIGNATURBLOCK_DE.table.main.Style.padding=3
sig_obj.SIGNATURBLOCK_DE.table.main.Style.border=0.1
sig_obj.SIGNATURBLOCK_DE.table.main.Style.halign=left
@@ -318,6 +330,54 @@ sig_obj.SIGNATURBLOCK_DE.table.info.6=SIG_ID-cv
###################################################################################################
+# PROFIL: minimaler Signaturblock (Deutsch)
+
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.description=minimale Standardsignatur Deutsch
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.key.SIG_META=Prüfinformation
+
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.value.SIG_META=Informationen zur Prüfung der elektronischen Signatur und des Ausdrucks finden Sie unter:\nhttps://www.buergerkarte.at/signature-verification
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.value.SIG_LABEL=./images/signatur-logo_de.png
+
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.pos=w:350.0
+
+#---------------------- MAIN TABLE -------------------------
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.1=SIG_LABEL-i|SIG_META-v
+
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.ColsWidth=1 4
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.Style.bgcolor=255 255 255
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.Style.padding=3
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.Style.border=0.1
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.Style.halign=left
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.Style.valign=middle
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.Style.font=HELVETICA,9,NORMAL
+sig_obj.SIGNATURBLOCK_MINIMAL_DE.table.main.Style.valuefont=HELVETICA,9,NORMAL
+
+
+###################################################################################################
+# PROFIL: minimaler Signaturblock (Englisch)
+
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.description=minimale Standardsignatur Englisch
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.key.SIG_META=Verification
+
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.value.SIG_META=Information about the verification of the electronic signature and of the printout can be found at:\nhttps://www.buergerkarte.at/signature-verification
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.value.SIG_LABEL=./images/signatur-logo_en.png
+
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.pos=w:350.0
+
+#---------------------- MAIN TABLE -------------------------
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.table.main.1=SIG_LABEL-i|SIG_META-v
+
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.table.main.ColsWidth=1 4
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.table.main.Style.bgcolor=255 255 255
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.table.main.Style.padding=3
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.table.main.Style.border=0.1
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.table.main.Style.halign=left
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.table.main.Style.valign=middle
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.table.main.Style.font=HELVETICA,9,NORMAL
+sig_obj.SIGNATURBLOCK_MINIMAL_EN.table.main.Style.valuefont=HELVETICA,9,NORMAL
+
+
+###################################################################################################
# PROFIL: Signaturblock (Englisch)
sig_obj.SIGNATURBLOCK_EN.description=Standardsignatur Englisch
@@ -340,7 +400,7 @@ sig_obj.SIGNATURBLOCK_EN.table.main.2=SIG_LABEL-i|TABLE-info
sig_obj.SIGNATURBLOCK_EN.table.main.3=SIG_META-cv
sig_obj.SIGNATURBLOCK_EN.table.main.ColsWidth=1 5
-sig_obj.SIGNATURBLOCK_EN.table.main.Style.bgcolor=245 245 240
+sig_obj.SIGNATURBLOCK_EN.table.main.Style.bgcolor=255 255 255
sig_obj.SIGNATURBLOCK_EN.table.main.Style.padding=3
sig_obj.SIGNATURBLOCK_EN.table.main.Style.border=0.1
sig_obj.SIGNATURBLOCK_EN.table.main.Style.halign=left
diff --git a/work/cfg/log4j.properties b/work/cfg/log4j.properties
index 1e964ff..2d3b0e0 100644
--- a/work/cfg/log4j.properties
+++ b/work/cfg/log4j.properties
@@ -16,7 +16,7 @@ log4j.appender.CONSOLE.Target = System.out
# ROLLINGFILE
log4j.appender.ROLLINGFILE = org.apache.log4j.RollingFileAppender
-log4j.appender.ROLLINGFILE.File = ${catalina.base}/logs/pdf-as.log
+log4j.appender.ROLLINGFILE.File = ${pdf-as.work-dir}/logs/pdf-as.log
log4j.appender.ROLLINGFILE.MaxFileSize = 10240KB
log4j.appender.ROLLINGFILE.MaxBackupIndex = 1
log4j.appender.ROLLINGFILE.layout = org.apache.log4j.PatternLayout
diff --git a/work/images/signatur-logo_de.png b/work/images/signatur-logo_de.png
index 4307f6a..1d55b60 100644
--- a/work/images/signatur-logo_de.png
+++ b/work/images/signatur-logo_de.png
Binary files differ
diff --git a/work/images/signatur-logo_en.png b/work/images/signatur-logo_en.png
index bcbe177..845bc07 100644
--- a/work/images/signatur-logo_en.png
+++ b/work/images/signatur-logo_en.png
Binary files differ