summaryrefslogtreecommitdiff
path: root/pdf-over-signer/pdf-over-sigpdfas4
diff options
context:
space:
mode:
authorTobias Kellner <tobias.kellner@iaik.tugraz.at>2014-11-27 20:48:16 +0100
committerTobias Kellner <tobias.kellner@iaik.tugraz.at>2014-11-27 20:48:16 +0100
commit896fbe4a5643bf8c29968f8514a1c14fd51c4d9e (patch)
tree0f3e3bec7093e9be39c94199b50db1a61154c54d /pdf-over-signer/pdf-over-sigpdfas4
parent5ef48a2002856bea0cac10e1dac6fb2985dca893 (diff)
downloadpdf-over-896fbe4a5643bf8c29968f8514a1c14fd51c4d9e.tar.gz
pdf-over-896fbe4a5643bf8c29968f8514a1c14fd51c4d9e.tar.bz2
pdf-over-896fbe4a5643bf8c29968f8514a1c14fd51c4d9e.zip
Add PDF-AS4 signer
Diffstat (limited to 'pdf-over-signer/pdf-over-sigpdfas4')
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/.classpath31
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/.project26
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.core.resources.prefs6
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.core.prefs97
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.ui.prefs3
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.m2e.core.prefs5
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.mylyn.tasks.ui.prefs4
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/pom.xml65
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java144
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java79
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java56
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java161
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java146
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java31
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java133
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/exceptions/PdfAs4SLRequestException.java34
-rw-r--r--pdf-over-signer/pdf-over-sigpdfas4/src/main/resources/qualified.cer19
17 files changed, 1040 insertions, 0 deletions
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.classpath b/pdf-over-signer/pdf-over-sigpdfas4/.classpath
new file mode 100644
index 00000000..eed8a51e
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/.classpath
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.project b/pdf-over-signer/pdf-over-sigpdfas4/.project
new file mode 100644
index 00000000..1d14e32f
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/.project
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>pdf-over-sigpdfas</name>
+ <comment></comment>
+ <projects>
+ <project>pdf-as-common</project>
+ <project>pdf-as-lib</project>
+ <project>sigs-pades</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.core.resources.prefs b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000..29abf999
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding/<project>=UTF-8
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.core.prefs b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..d598cb6b
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,97 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
+org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,LOW
+org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,NOTE
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.ui.prefs b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000..05288cb4
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\n * Copyright 2012 by A-SIT, Secure Information Technology Center Austria\n *\n * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by\n * the European Commission - subsequent versions of the EUPL (the "Licence");\n * You may not use this work except in compliance with the Licence.\n * You may obtain a copy of the Licence at\:\n * http\://joinup.ec.europa.eu/software/page/eupl\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the Licence is distributed on an "AS IS" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the Licence for the specific language governing permissions and\n * limitations under the Licence.\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * \n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n// Imports\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="false" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">/**\n * SLF4J Logger instance\n **/\nprivate static final Logger log \= LoggerFactory.getLogger(${type_name}.class);\n\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.m2e.core.prefs b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 00000000..62e91186
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,5 @@
+#Thu Aug 02 12:33:52 CEST 2012
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.mylyn.tasks.ui.prefs b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.mylyn.tasks.ui.prefs
new file mode 100644
index 00000000..c6aa7359
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/.settings/org.eclipse.mylyn.tasks.ui.prefs
@@ -0,0 +1,4 @@
+#Fri Aug 03 18:56:31 CEST 2012
+eclipse.preferences.version=1
+project.repository.kind=jira
+project.repository.url=http\://jira.egovlabs.gv.at
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/pom.xml b/pdf-over-signer/pdf-over-sigpdfas4/pom.xml
new file mode 100644
index 00000000..482eade1
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/pom.xml
@@ -0,0 +1,65 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>pdf-over-signer</artifactId>
+ <groupId>at.a-sit</groupId>
+ <version>4.0.5-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>pdf-over-sigpdfas4</artifactId>
+ <name>PDF-Over PDF-AS 4 Signer</name>
+ <properties>
+ <project.maindir>${project.basedir}/../..</project.maindir>
+ <pdf-as.version>4.0.5-SNAPSHOT</pdf-as.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>at.a-sit</groupId>
+ <artifactId>pdf-over-signator</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.pdfas</groupId>
+ <artifactId>pdf-as-lib</artifactId>
+ <version>${pdf-as.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.pdfas</groupId>
+ <artifactId>sigs-pades</artifactId>
+ <version>${pdf-as.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>at.gv.egiz.pdfas</groupId>
+ <artifactId>pdf-as-pdfbox</artifactId>
+ <version>${pdf-as.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>iaik</groupId>
+ <artifactId>iaik_jce_full_signed</artifactId>
+ <version>5.2</version>
+ </dependency>
+ <dependency>
+ <groupId>iaik</groupId>
+ <artifactId>iaik_eccelerate</artifactId>
+ <version>2.15</version>
+ </dependency>
+ <dependency>
+ <groupId>iaik</groupId>
+ <artifactId>iaik_cms</artifactId>
+ <version>2.15</version>
+ </dependency>
+ <dependency>
+ <groupId>iaik</groupId>
+ <artifactId>iaik_eccelerate_cms</artifactId>
+ <version>2.15</version>
+ </dependency>
+ </dependencies>
+ <!--repositories>
+ <repository>
+ <id>pdf-as-4</id>
+ <name>PDF-AS 4 Repository</name>
+ <url>https://joinup.ec.europa.eu/site/pdf-as/maven/</url>
+ <url>http://demo.egiz.gv.at/pdf-as-mvn-snpshot/</url>
+ </repository>
+ </repositories-->
+</project>
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java
new file mode 100644
index 00000000..33221285
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4BKUSLConnector.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://joinup.ec.europa.eu/software/page/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package at.asit.pdfover.signer.pdfas;
+
+// Imports
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.asit.pdfover.signator.BkuSlConnector;
+import at.asit.pdfover.signator.SignatureException;
+import at.asit.pdfover.signer.pdfas.exceptions.PdfAs4SLRequestException;
+import at.gv.egiz.pdfas.common.exceptions.PDFIOException;
+import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
+import at.gv.egiz.pdfas.common.exceptions.SLPdfAsException;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
+import at.gv.egiz.sl.schema.CreateCMSSignatureResponseType;
+import at.gv.egiz.sl.schema.ErrorResponseType;
+import at.gv.egiz.sl.schema.InfoboxReadRequestType;
+import at.gv.egiz.sl.schema.InfoboxReadResponseType;
+import at.gv.egiz.sl.util.BaseSLConnector;
+import at.gv.egiz.sl.util.RequestPackage;
+import at.gv.egiz.sl.util.SLMarschaller;
+
+/**
+ *
+ */
+public class PdfAs4BKUSLConnector extends BaseSLConnector {
+ /**
+ * SLF4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory
+ .getLogger(PdfAs4BKUSLConnector.class);
+
+ private BkuSlConnector connector;
+
+ /**
+ * Constructor
+ * @param connector the BKU SL Connector
+ */
+ public PdfAs4BKUSLConnector(BkuSlConnector connector) {
+ this.connector = connector;
+ }
+
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.sl.util.ISLConnector#sendInfoboxReadRequest(at.gv.egiz.sl.schema.InfoboxReadRequestType, at.gv.egiz.pdfas.lib.api.sign.SignParameter)
+ */
+ @Override
+ public InfoboxReadResponseType sendInfoboxReadRequest(
+ InfoboxReadRequestType request, SignParameter parameter)
+ throws PdfAsException {
+ JAXBElement<?> element = null;
+ try {
+ String slRequestString = SLMarschaller.marshalToString(this.of.createInfoboxReadRequest(request));
+ log.trace(slRequestString);
+
+ PdfAs4SLRequest slRequest = new PdfAs4SLRequest(slRequestString, null);
+ String slResponse = this.connector.handleSLRequest(slRequest).getSLRespone();
+
+ element = (JAXBElement<?>) SLMarschaller
+ .unmarshalFromString(slResponse);
+ } catch (JAXBException e) {
+ throw new PDFIOException("error.pdf.io.03", e);
+ } catch (PdfAs4SLRequestException e) {
+ throw new PDFIOException("error.pdf.io.03", e);
+ } catch (SignatureException e) {
+ throw new PDFIOException("error.pdf.io.03", e);
+ }
+
+ if (element == null) {
+ throw new PDFIOException("error.pdf.io.04");
+ }
+
+ if (element.getValue() instanceof InfoboxReadResponseType) {
+ InfoboxReadResponseType infoboxReadResponseType = (InfoboxReadResponseType) element
+ .getValue();
+ return infoboxReadResponseType;
+ } else if (element.getValue() instanceof ErrorResponseType) {
+ ErrorResponseType errorResponseType = (ErrorResponseType) element
+ .getValue();
+ throw new SLPdfAsException(errorResponseType.getErrorCode(),
+ errorResponseType.getInfo());
+ }
+ throw new PdfAsException("error.pdf.io.03");
+ }
+
+ /* (non-Javadoc)
+ * @see at.gv.egiz.sl.util.ISLConnector#sendCMSRequest(at.gv.egiz.sl.util.RequestPackage, at.gv.egiz.pdfas.lib.api.sign.SignParameter)
+ */
+ @Override
+ public CreateCMSSignatureResponseType sendCMSRequest(RequestPackage pack,
+ SignParameter parameter) throws PdfAsException {
+ JAXBElement<?> element = null;
+ try {
+ String slRequestString = SLMarschaller.marshalToString(this.of.createCreateCMSSignatureRequest(pack.getRequestType()));
+ log.debug(slRequestString);
+
+ PdfAs4SLRequest slRequest = new PdfAs4SLRequest(slRequestString, pack.getSignatureData());
+ String slResponse = this.connector.handleSLRequest(slRequest).getSLRespone();
+
+ element = (JAXBElement<?>) SLMarschaller
+ .unmarshalFromString(slResponse);
+ } catch (JAXBException e) {
+ throw new PDFIOException("error.pdf.io.03", e);
+ } catch (PdfAs4SLRequestException e) {
+ throw new PDFIOException("error.pdf.io.03", e);
+ } catch (SignatureException e) {
+ throw new PDFIOException("error.pdf.io.03", e);
+ }
+
+ if (element == null) {
+ throw new PDFIOException("error.pdf.io.05");
+ }
+
+ if (element.getValue() instanceof CreateCMSSignatureResponseType) {
+ CreateCMSSignatureResponseType createCMSSignatureResponseType = (CreateCMSSignatureResponseType) element
+ .getValue();
+ log.debug(createCMSSignatureResponseType.toString());
+ return createCMSSignatureResponseType;
+ } else if (element.getValue() instanceof ErrorResponseType) {
+ ErrorResponseType errorResponseType = (ErrorResponseType) element
+ .getValue();
+ throw new SLPdfAsException(errorResponseType.getErrorCode(),
+ errorResponseType.getInfo());
+ }
+ throw new PdfAsException("error.pdf.io.03");
+ }
+}
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java
new file mode 100644
index 00000000..21a6bbdb
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Helper.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://joinup.ec.europa.eu/software/page/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package at.asit.pdfover.signer.pdfas;
+
+// Imports
+import java.io.File;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.asit.pdfover.signator.SignatureException;
+import at.gv.egiz.pdfas.lib.api.PdfAs;
+import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
+
+/**
+ * PDF-AS 4 Helper
+ */
+public class PdfAs4Helper {
+ /**
+ * SLF4J Logger instance
+ **/
+ @SuppressWarnings("unused")
+ private static final Logger log = LoggerFactory
+ .getLogger(PdfAs4Helper.class);
+
+ /**
+ * PDF-AS Object
+ */
+ private static PdfAs pdfAs = null;
+
+ /**
+ * Gets PDF-AS Object
+ * @return the PDF-AS Object
+ * @throws SignatureException
+ */
+ public static synchronized PdfAs getPdfAs() throws SignatureException {
+ if (pdfAs == null) {
+ try {
+ pdfAs = createPdfAs();
+ } catch(Exception e) {
+ throw new SignatureException(e);
+ }
+ }
+ return pdfAs;
+ }
+
+ /**
+ * Creates PDF-AS Object
+ * @return the PDF-AS Object
+ * @throws PdfAsException
+ */
+ private static PdfAs createPdfAs() {
+ File directory = new File (".");
+ System.setProperty("log4j.configuration", directory.getAbsolutePath() +
+ "/log4j.properties");
+ return PdfAsFactory.createPdfAs(new File(getWorkDir()));
+ }
+
+ /**
+ * Provides the working directory
+ * @return the working directory
+ */
+ public static String getWorkDir() {
+ return System.getProperty("user.home") + "/.pdf-over";
+ }
+}
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java
new file mode 100644
index 00000000..87babd59
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SLRequest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://joinup.ec.europa.eu/software/page/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package at.asit.pdfover.signer.pdfas;
+
+// Imports
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.asit.pdfover.signator.ByteArrayDocumentSource;
+import at.asit.pdfover.signator.SLRequest;
+import at.asit.pdfover.signer.pdfas.exceptions.PdfAs4SLRequestException;
+
+/**
+ * PDF - AS Security Layer Request implementation
+ */
+public class PdfAs4SLRequest extends SLRequest {
+
+ /**
+ * SLF4J Logger instance
+ **/
+ @SuppressWarnings("unused")
+ private static final Logger log = LoggerFactory.getLogger(PdfAs4SLRequest.class);
+
+ /**
+ * Default constructor
+ * @param slRequest
+ * @param signData
+ * @throws PdfAs4SLRequestException
+ */
+ public PdfAs4SLRequest(String slRequest, byte[] signData) throws PdfAs4SLRequestException {
+// if(!slRequest.contains(PdfAs4Signer.LOC_REF)) {
+// log.error("PDF-AS SL request doesn't contain " + PdfAs4Signer.LOC_REF);
+// log.debug("Request: " + slRequest);
+// throw new PdfAs4SLRequestException("PDF-AS SL request doesn't contain " + PdfAs4Signer.LOC_REF);
+// }
+//
+// // Modifing SL Request ...
+// setRequest(slRequest.replace(PdfAs4Signer.LOC_REF, SLRequest.DATAOBJECT_STRING));
+
+ setRequest(slRequest);
+ setSignatureData(signData == null ? null : new ByteArrayDocumentSource(signData));
+ }
+}
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
new file mode 100644
index 00000000..38aabadd
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignatureParameter.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://joinup.ec.europa.eu/software/page/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package at.asit.pdfover.signer.pdfas;
+
+//Imports
+import iaik.x509.X509Certificate;
+
+import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.util.HashMap;
+import java.util.Locale;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.asit.pdfover.signator.SignatureDimension;
+import at.asit.pdfover.signator.SignatureParameter;
+import at.asit.pdfover.signator.SignaturePosition;
+import at.gv.egiz.pdfas.lib.api.Configuration;
+import at.gv.egiz.pdfas.lib.api.PdfAs;
+import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
+
+/**
+ * Implementation of SignatureParameter for PDF-AS 4 Library
+ */
+public class PdfAs4SignatureParameter extends SignatureParameter {
+ /** The profile ID for the German signature block */
+ private static final String PROFILE_ID_DE = "SIGNATURBLOCK_SMALL_DE_PDFA";
+ /** The profile ID for the German signature block if a signature note is set */
+ private static final String PROFILE_ID_DE_NOTE = "SIGNATURBLOCK_SMALL_DE_NOTE_PDFA";
+ /** The profile ID for the English signature block */
+ private static final String PROFILE_ID_EN = "SIGNATURBLOCK_SMALL_EN_PDFA";
+ /** The profile ID for the English signature block if a signature note is set */
+ private static final String PROFILE_ID_EN_NOTE = "SIGNATURBLOCK_SMALL_EN_NOTE_PDFA";
+
+ private HashMap<String, String> genericProperties = new HashMap<String, String>();
+
+ private int sig_w = 229;
+ private int sig_h = 77;
+
+ /**
+ * SLF4J Logger instance
+ **/
+ static final Logger log = LoggerFactory
+ .getLogger(PdfAs4SignatureParameter.class);
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.SignatureParameter#getPlaceholderDimension()
+ */
+ @Override
+ public SignatureDimension getPlaceholderDimension() {
+ return new SignatureDimension(this.sig_w, this.sig_h);
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.SignatureParameter#getPlaceholder()
+ */
+ @Override
+ public Image getPlaceholder() {
+ String sigProfile = getPdfAsSignatureProfileId();
+ String sigEmblem = (getEmblem() == null ? null : getEmblem().getFileName());
+ String sigNote = getProperty("SIG_NOTE");
+
+ try {
+ X509Certificate cert = new X509Certificate(PdfAs4SignatureParameter.class.getResourceAsStream("/qualified.cer"));
+ PdfAs pdfas = PdfAs4Helper.getPdfAs();
+ Configuration conf = pdfas.getConfiguration();
+ if (sigEmblem != null && !sigEmblem.trim().equals("")) {
+ conf.setValue("sig_obj." + sigProfile + ".value.SIG_LABEL", sigEmblem);
+ }
+ if (sigNote != null) {
+ conf.setValue("sig_obj." + sigProfile + ".value.SIG_NOTE", sigNote);
+ }
+ SignParameter param = PdfAsFactory
+ .createSignParameter(conf, null, null);
+ param.setSignatureProfileId(sigProfile);
+ Image img = pdfas.generateVisibleSignaturePreview(param, cert, 72*4);
+ this.sig_w = img.getWidth(null)/4;
+ this.sig_h = img.getHeight(null)/4;
+
+ return img;
+ } catch (Exception e) {
+ log.error("Failed to get signature placeholder", e);
+ return new BufferedImage(getPlaceholderDimension().getWidth(),
+ getPlaceholderDimension().getHeight(),
+ BufferedImage.TYPE_INT_RGB);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.SignatureParameter#setProperty(java.lang.String, java.lang.String)
+ */
+ @Override
+ public void setProperty(String key, String value) {
+ this.genericProperties.put(key, value);
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.SignatureParameter#getProperty(java.lang.String)
+ */
+ @Override
+ public String getProperty(String key) {
+ return this.genericProperties.get(key);
+ }
+
+ /**
+ * Gets the Signature Position String for PDF-AS
+ *
+ * @return Signature Position String
+ */
+ public String getPdfAsSignaturePosition() {
+ SignaturePosition in_pos = getSignaturePosition();
+ String out_pos;
+
+ if (!in_pos.useAutoPositioning()) {
+ if (in_pos.getPage() < 1) {
+ out_pos = String.format(
+ (Locale) null,
+ "p:new;x:%f;y:%f", in_pos.getX(),
+ in_pos.getY());
+ } else {
+ out_pos = String.format(
+ (Locale) null,
+ "p:%d;x:%f;y:%f", in_pos.getPage(), in_pos.getX(),
+ in_pos.getY());
+ }
+ } else {
+ out_pos = "p:auto;x:auto;y:auto";
+ }
+
+ return out_pos;
+ }
+
+ /**
+ * Get the Signature Profile ID for this set of parameters
+ * @return the Signature Profile ID
+ */
+ public String getPdfAsSignatureProfileId() {
+ String lang = getSignatureLanguage();
+ boolean useNote = (getProperty("SIG_NOTE") != null);
+
+ if (lang != null && lang.equals("en"))
+ return useNote ? PROFILE_ID_EN_NOTE : PROFILE_ID_EN;
+
+ return useNote ? PROFILE_ID_DE_NOTE : PROFILE_ID_DE;
+ }
+}
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
new file mode 100644
index 00000000..0f42a517
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4Signer.java
@@ -0,0 +1,146 @@
+package at.asit.pdfover.signer.pdfas;
+
+import java.io.ByteArrayOutputStream;
+import java.util.UUID;
+
+import javax.activation.DataSource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.asit.pdfover.signator.ByteArrayDocumentSource;
+import at.asit.pdfover.signator.SignResult;
+import at.asit.pdfover.signator.SignResultImpl;
+import at.asit.pdfover.signator.SignatureException;
+import at.asit.pdfover.signator.SignatureParameter;
+import at.asit.pdfover.signator.SignaturePosition;
+import at.asit.pdfover.signator.Signer;
+import at.asit.pdfover.signator.SigningState;
+import at.gv.egiz.pdfas.common.exceptions.PDFASError;
+import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
+import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource;
+import at.gv.egiz.pdfas.lib.api.Configuration;
+import at.gv.egiz.pdfas.lib.api.PdfAs;
+import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
+import at.gv.egiz.pdfas.sigs.pades.PAdESSigner;
+import at.gv.egiz.sl.util.ISLConnector;
+import at.knowcenter.wag.egov.egiz.pdf.TablePos;
+
+/**
+ * PDF AS Signer Implementation
+ */
+public class PdfAs4Signer implements Signer {
+
+ /**
+ * SLF4J Logger instance
+ **/
+ static final Logger log = LoggerFactory.getLogger(PdfAs4Signer.class);
+
+ /**
+ * The template URL
+ */
+ protected static final String URL_TEMPLATE = "http://pdfover.4.gv.at/template";
+
+ /**
+ * Location reference string
+ */
+ protected static final String LOC_REF = "<sl:LocRefContent>" + URL_TEMPLATE
+ + "</sl:LocRefContent>";
+
+ @Override
+ public SigningState prepare(SignatureParameter parameter)
+ throws SignatureException {
+ PdfAs4SignatureParameter sign_para = null;
+
+ if (PdfAs4SignatureParameter.class.isInstance(parameter)) {
+ sign_para = PdfAs4SignatureParameter.class.cast(parameter);
+ }
+
+ if (sign_para == null) {
+ throw new SignatureException("Incorrect SignatureParameter!");
+ }
+
+ String sigProfile = sign_para.getPdfAsSignatureProfileId();
+ String sigEmblem = (sign_para.getEmblem() == null ? null : sign_para.getEmblem().getFileName());
+ String sigNote = sign_para.getProperty("SIG_NOTE");
+ String sigPos = sign_para.getPdfAsSignaturePosition();
+
+ PdfAs pdfas = PdfAs4Helper.getPdfAs();
+ Configuration config = pdfas.getConfiguration();
+ if (sigEmblem != null && !sigEmblem.trim().isEmpty()) {
+ config.setValue("sig_obj." + sigProfile + ".value.SIG_LABEL", sigEmblem);
+ }
+
+ if(sigNote != null) {
+ config.setValue("sig_obj." + sigProfile + ".value.SIG_NOTE", sigNote);
+ }
+
+ PdfAs4SigningState state = new PdfAs4SigningState();
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ DataSource input = new ByteArrayDataSource(parameter.getInputDocument().getByteArray());
+ SignParameter param = PdfAsFactory.createSignParameter(config, input, output);
+ param.setSignaturePosition(sigPos);
+ param.setSignatureProfileId(sigProfile);
+ String id = UUID.randomUUID().toString();
+ param.setTransactionId(id);
+ state.setSignParameter(param);
+ state.setOutput(output);
+ return state;
+ }
+
+ @Override
+ public SignResult sign(SigningState state) throws SignatureException {
+ try {
+ PdfAs4SigningState sstate = null;
+
+ if (PdfAs4SigningState.class.isInstance(state)) {
+ sstate = PdfAs4SigningState.class.cast(state);
+ }
+
+ if (sstate == null) {
+ throw new SignatureException("Incorrect SigningState!");
+ }
+
+ // Retrieve objects
+ PdfAs pdfas = PdfAs4Helper.getPdfAs();
+
+ SignParameter param = sstate.getSignParameter();
+
+ ISLConnector connector = new PdfAs4BKUSLConnector(sstate.getBKUConnector());
+ param.setPlainSigner(new PAdESSigner(connector));
+
+ pdfas.sign(param);
+
+ // Preparing Result Response
+ SignResultImpl result = new SignResultImpl();
+
+// // Set Signer Certificate
+// result.setSignerCertificate(..);
+
+ // Set Signature position
+ TablePos tp = new TablePos(param.getSignaturePosition());
+ SignaturePosition sp;
+ if (tp.isXauto() && tp.isYauto())
+ sp = new SignaturePosition();
+ else if (tp.isPauto())
+ sp = new SignaturePosition(tp.getPosX(), tp.getPosY());
+ else
+ sp = new SignaturePosition(tp.getPosX(), tp.getPosY(), tp.getPage());
+ result.setSignaturePosition(sp);
+
+ // Set signed Document
+ result.setSignedDocument(new ByteArrayDocumentSource(sstate.getOutput().toByteArray()));
+ return result;
+ } catch (PdfAsException e) {
+ throw new SignatureException(e);
+ } catch (PDFASError e) {
+ throw new SignatureException(e);
+ }
+ }
+
+ @Override
+ public SignatureParameter newParameter() {
+ return new PdfAs4SignatureParameter();
+ }
+}
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java
new file mode 100644
index 00000000..3fa7ce16
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SignerFactory.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://joinup.ec.europa.eu/software/page/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package at.asit.pdfover.signer.pdfas;
+
+//Imports
+import at.asit.pdfover.signator.Signer;
+import at.asit.pdfover.signator.SignerFactory;
+
+/**
+ * Factory class for PDF-AS Signer
+ */
+public class PdfAs4SignerFactory extends SignerFactory {
+
+ @Override
+ public Signer createSigner() {
+ return new PdfAs4Signer();
+ }
+}
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java
new file mode 100644
index 00000000..b8280142
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/PdfAs4SigningState.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://joinup.ec.europa.eu/software/page/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package at.asit.pdfover.signer.pdfas;
+
+//Imports
+import java.io.ByteArrayOutputStream;
+
+import at.asit.pdfover.signator.BkuSlConnector;
+import at.asit.pdfover.signator.SLRequest;
+import at.asit.pdfover.signator.SLResponse;
+import at.asit.pdfover.signator.SigningState;
+import at.gv.egiz.pdfas.lib.api.sign.SignParameter;
+
+/**
+ * Signing State for PDFAS Wrapper
+ */
+public class PdfAs4SigningState implements SigningState {
+
+ /**
+ * The Signature Layer request
+ */
+ private SLRequest slrequest;
+
+ /**
+ * The Signature Layer response
+ */
+ private SLResponse slresponse;
+
+ /**
+ * The Sign Parameters
+ */
+ private SignParameter parameter;
+
+ private ByteArrayOutputStream output;
+
+ private BkuSlConnector connector;
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.SigningState#getSignatureRequest()
+ */
+ @Override
+ public SLRequest getSignatureRequest() {
+ return this.slrequest;
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.SigningState#setSignatureResponse(at.asit.pdfover.signator.SLResponse)
+ */
+ @Override
+ public void setSignatureResponse(SLResponse response) {
+ this.slresponse = response;
+ }
+
+ /**
+ * Sets the SL Request
+ * @param request The SL Request
+ */
+ public void setSignatureRequest(SLRequest request) {
+ this.slrequest = request;
+ }
+
+ /**
+ * Gets the SL Response
+ * @return The SL Response object
+ */
+ public SLResponse getSignatureResponse() {
+ return this.slresponse;
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.SigningState#hasSignatureResponse()
+ */
+ @Override
+ public boolean hasSignatureResponse() {
+ return this.slresponse != null;
+ }
+
+ /**
+ * @return the output
+ */
+ public ByteArrayOutputStream getOutput() {
+ return this.output;
+ }
+
+ /**
+ * @param output the output to set
+ */
+ public void setOutput(ByteArrayOutputStream output) {
+ this.output = output;
+ }
+
+ /**
+ * @return the parameter
+ */
+ public SignParameter getSignParameter() {
+ return this.parameter;
+ }
+
+ /**
+ * @param parameter the parameter to set
+ */
+ public void setSignParameter(SignParameter parameter) {
+ this.parameter = parameter;
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.signator.SigningState#setBKUConnector(at.asit.pdfover.signator.BkuSlConnector)
+ */
+ @Override
+ public void setBKUConnector(BkuSlConnector connector) {
+ this.connector = connector;
+ }
+
+ /**
+ * @return the connector
+ */
+ public BkuSlConnector getBKUConnector() {
+ return this.connector;
+ }
+}
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/exceptions/PdfAs4SLRequestException.java b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/exceptions/PdfAs4SLRequestException.java
new file mode 100644
index 00000000..70fe04c3
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/java/at/asit/pdfover/signer/pdfas/exceptions/PdfAs4SLRequestException.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://joinup.ec.europa.eu/software/page/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package at.asit.pdfover.signer.pdfas.exceptions;
+
+/**
+ *
+ */
+public class PdfAs4SLRequestException extends Exception {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6855855001105199269L;
+
+ /**
+ * Constructor
+ * @param msg
+ */
+ public PdfAs4SLRequestException(String msg) {
+ super(msg);
+ }
+}
diff --git a/pdf-over-signer/pdf-over-sigpdfas4/src/main/resources/qualified.cer b/pdf-over-signer/pdf-over-sigpdfas4/src/main/resources/qualified.cer
new file mode 100644
index 00000000..e083c81e
--- /dev/null
+++ b/pdf-over-signer/pdf-over-sigpdfas4/src/main/resources/qualified.cer
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDJjCCAg4CCQDj2QcuXR0CJjANBgkqhkiG9w0BAQsFADBVMQswCQYDVQQGEwJB
+VDEPMA0GA1UECAwGU3R5cmlhMQ0wCwYDVQQHDARHcmF6MQ0wCwYDVQQKDARFR0la
+MRcwFQYDVQQDDA5NYXggTXVzdGVybWFubjAeFw0xNDExMDYwOTQyMTVaFw0yNDEx
+MDMwOTQyMTVaMFUxCzAJBgNVBAYTAkFUMQ8wDQYDVQQIDAZTdHlyaWExDTALBgNV
+BAcMBEdyYXoxDTALBgNVBAoMBEVHSVoxFzAVBgNVBAMMDk1heCBNdXN0ZXJtYW5u
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwKREoPZyoxmmXiULkXA/
+onwGn+J9pXX2f9AZ7ktHhoRmV3ZJgfv2rCcSO1gAwRUyJY2MFfaDMfQchooHS7e0
++nOFKfHt5QtwkK6TYImWiFZRjoTgsDW8tTFrrR82k6LNUi5Upj3l6t7mxOdWdJBA
+U0cmqALW5QQTbnbeJFVlCrTiIRBgB+G+jXBu8C64/HS5rbUUccPXxU8Mi3OnUVVd
+R9AL5RothHeCIcw19rAXaU7+o/jNPeTm5mdJqG+3+mca7qBBszvOPCTnMj81fdmX
+R7NWCkkT8gAlB602IBhWUUx/Az8zVglsDoL61RNXn5EA2Ajq75qUkalN5zJNytie
+AQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBZuxsCprwxByxRab8S97HP1Qpb8dlM
+TVdqCYMRNCik4e7l04OAJdX62H1xtL3npoT0C+pM+fkUNk9E18UTvA3jyeQXJ6f+
+z1nzdTbHVE1HANveqvUgq+LqTCTfVLk09mFmEIZnkPVd97XarmxrfCJbCaiYljka
+b63ER+87QE9YiN38nZpIlocOcI9QQVpE8boRCjgyJF3i84lIbKgwM32nWs0Sz+p1
+ewWHeQw3oziie3MfH3Xkag341i/k+7VF0FxLuPn7DZB4M5pZmjy0DNA/bdhGNu96
+pOjb/TWp18KMqCMrMAGLz/cjgWqbC4KkzPUtYx6HmCdtVXHWwRV7Lgto
+-----END CERTIFICATE-----