summaryrefslogtreecommitdiff
path: root/pdf-over-signator
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-signator')
-rw-r--r--pdf-over-signator/.classpath10
-rw-r--r--pdf-over-signator/.project23
-rw-r--r--pdf-over-signator/.settings/org.eclipse.core.resources.prefs7
-rw-r--r--pdf-over-signator/.settings/org.eclipse.jdt.core.prefs98
-rw-r--r--pdf-over-signator/.settings/org.eclipse.m2e.core.prefs5
-rw-r--r--pdf-over-signator/.settings/org.eclipse.mylyn.tasks.ui.prefs4
-rw-r--r--pdf-over-signator/pom.xml18
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/ByteArrayDocumentSource.java39
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/DocumentSource.java27
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java12
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java12
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLResponse.java25
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java27
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResultImpl.java52
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java58
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureDimension.java69
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureException.java45
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java117
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignaturePosition.java107
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signer.java33
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignerFactory.java15
-rw-r--r--pdf-over-signator/src/main/java/at/asit/pdfover/signator/SigningState.java19
22 files changed, 822 insertions, 0 deletions
diff --git a/pdf-over-signator/.classpath b/pdf-over-signator/.classpath
new file mode 100644
index 00000000..0f53f3e2
--- /dev/null
+++ b/pdf-over-signator/.classpath
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/pdf-over-signator/.project b/pdf-over-signator/.project
new file mode 100644
index 00000000..e6d690af
--- /dev/null
+++ b/pdf-over-signator/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>pdf-over-signator</name>
+ <comment></comment>
+ <projects>
+ </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-signator/.settings/org.eclipse.core.resources.prefs b/pdf-over-signator/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000..7f5422a4
--- /dev/null
+++ b/pdf-over-signator/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,7 @@
+#Thu Aug 02 13:12:39 CEST 2012
+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-signator/.settings/org.eclipse.jdt.core.prefs b/pdf-over-signator/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..3e73d18e
--- /dev/null
+++ b/pdf-over-signator/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,98 @@
+#Fri Aug 03 18:09:51 CEST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+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-signator/.settings/org.eclipse.m2e.core.prefs b/pdf-over-signator/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 00000000..031daaa1
--- /dev/null
+++ b/pdf-over-signator/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,5 @@
+#Thu Aug 02 12:30:29 CEST 2012
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/pdf-over-signator/.settings/org.eclipse.mylyn.tasks.ui.prefs b/pdf-over-signator/.settings/org.eclipse.mylyn.tasks.ui.prefs
new file mode 100644
index 00000000..c50cb4e0
--- /dev/null
+++ b/pdf-over-signator/.settings/org.eclipse.mylyn.tasks.ui.prefs
@@ -0,0 +1,4 @@
+#Fri Aug 03 18:56:19 CEST 2012
+eclipse.preferences.version=1
+project.repository.kind=jira
+project.repository.url=http\://jira.egovlabs.gv.at
diff --git a/pdf-over-signator/pom.xml b/pdf-over-signator/pom.xml
new file mode 100644
index 00000000..a6cddab4
--- /dev/null
+++ b/pdf-over-signator/pom.xml
@@ -0,0 +1,18 @@
+<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</artifactId>
+ <groupId>a-sit.at</groupId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>pdf-over-signator</artifactId>
+ <name>PDF-Over Signator</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/ByteArrayDocumentSource.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/ByteArrayDocumentSource.java
new file mode 100644
index 00000000..812ddc88
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/ByteArrayDocumentSource.java
@@ -0,0 +1,39 @@
+package at.asit.pdfover.signator;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+/**
+ * A DocumentSource using a byte[] to store the document content
+ */
+public class ByteArrayDocumentSource implements DocumentSource {
+
+ /**
+ * Document content
+ */
+ protected byte[] data;
+
+ /**
+ * Constructor with byte[] content
+ * @param data the document content
+ */
+ public ByteArrayDocumentSource(byte[] data) {
+ this.data = data;
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ return new ByteArrayInputStream(this.data);
+ }
+
+ @Override
+ public int getLength() {
+ return this.data.length;
+ }
+
+ @Override
+ public byte[] getByteArray() {
+ return this.data;
+ }
+
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/DocumentSource.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/DocumentSource.java
new file mode 100644
index 00000000..8b444020
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/DocumentSource.java
@@ -0,0 +1,27 @@
+package at.asit.pdfover.signator;
+
+import java.io.InputStream;
+
+/**
+ * A Document Source
+ */
+public interface DocumentSource {
+
+ /**
+ * Gets Document as Input Stream
+ * @return InputStream of the document
+ */
+ public InputStream getInputStream();
+
+ /**
+ * Get Length of document
+ * @return length of the document
+ */
+ public int getLength();
+
+ /**
+ * Get Document as byte[]
+ * @return byte[] of the Document
+ */
+ public byte[] getByteArray();
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java
new file mode 100644
index 00000000..e86b7100
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Emblem.java
@@ -0,0 +1,12 @@
+package at.asit.pdfover.signator;
+
+/**
+ * Provides a logo for a signature block
+ */
+public interface Emblem {
+ /**
+ * Return the file name of the Emblem
+ * @return the file name
+ */
+ public String getFileName();
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java
new file mode 100644
index 00000000..9b393e46
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLRequest.java
@@ -0,0 +1,12 @@
+package at.asit.pdfover.signator;
+
+/**
+ * Security Layer Request
+ */
+public interface SLRequest {
+ /**
+ * Gets the signature data for this request
+ * @return The document source
+ */
+ public DocumentSource getSignatureData();
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLResponse.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLResponse.java
new file mode 100644
index 00000000..88adc117
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SLResponse.java
@@ -0,0 +1,25 @@
+package at.asit.pdfover.signator;
+
+/**
+ * Security Layer response
+ */
+public class SLResponse {
+
+ private String response;
+
+ /**
+ * Create a new Security Layer response
+ * @param response the SLResponse
+ */
+ public SLResponse(String response) {
+ this.response = response;
+ }
+
+ /**
+ * Get the Security Layer response text
+ * @return the Security Layer response text
+ */
+ public String getSLRespone() {
+ return this.response;
+ }
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java
new file mode 100644
index 00000000..7a8d4d0d
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResult.java
@@ -0,0 +1,27 @@
+package at.asit.pdfover.signator;
+
+import java.security.cert.X509Certificate;
+
+/**
+ * Signature Result containing the signed document as document source
+ */
+public interface SignResult {
+
+ /**
+ * Getter of the property <tt>signaturePosition</tt>
+ * @return Returns the signaturePosition.
+ */
+ public SignaturePosition getSignaturePosition();
+
+ /**
+ * Gets the signed Document
+ * @return Returns the documentSource.
+ */
+ public DocumentSource getSignedDocument();
+
+ /**
+ * Gets the signer certificate
+ * @return The signer x509 certificate
+ */
+ public X509Certificate getSignerCertificate();
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResultImpl.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResultImpl.java
new file mode 100644
index 00000000..dc0986cf
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignResultImpl.java
@@ -0,0 +1,52 @@
+package at.asit.pdfover.signator;
+
+import java.security.cert.X509Certificate;
+
+/**
+ * The result of a signature operation
+ */
+public class SignResultImpl implements SignResult {
+
+ private SignaturePosition position;
+ private DocumentSource source;
+ private X509Certificate certificate;
+
+ @Override
+ public SignaturePosition getSignaturePosition() {
+ return this.position;
+ }
+
+ @Override
+ public DocumentSource getSignedDocument() {
+ return this.source;
+ }
+
+ @Override
+ public X509Certificate getSignerCertificate() {
+ return this.certificate;
+ }
+
+ /**
+ * Set the signer certificate
+ * @param x509Certificate the signer certificate
+ */
+ public void setSignerCertificate(X509Certificate x509Certificate) {
+ this.certificate = x509Certificate;
+ }
+
+ /**
+ * Set the signature position
+ * @param postion the signature position
+ */
+ public void setSignaturePosition(SignaturePosition postion) {
+ this.position = postion;
+ }
+
+ /**
+ * Set the signed document
+ * @param source DocumentSource containing the signed document
+ */
+ public void setSignedDocument(DocumentSource source) {
+ this.source = source;
+ }
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java
new file mode 100644
index 00000000..4ba0b981
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signator.java
@@ -0,0 +1,58 @@
+package at.asit.pdfover.signator;
+
+import java.util.EnumMap;
+import java.util.Map;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * PDF Signator Interface
+ */
+public class Signator {
+
+ private static Logger log = LoggerFactory.getLogger(Signator.class);
+
+ /**
+ * List of available PDF signing libraries
+ */
+ public enum Signers {
+ /**
+ * PDF-AS
+ */
+ PDFAS
+ };
+
+ private static Map<Signers, SignerFactory> factoryMap;
+
+ static {
+ factoryMap = new EnumMap<Signers, SignerFactory>(Signers.class);
+
+ try {
+ Class<?> pdfAsClass = Class.forName("at.asit.pdfover.signer.pdfas.PDFASSignerFactory");
+ SignerFactory factory = (SignerFactory)pdfAsClass.newInstance();
+ registerSigner(Signers.PDFAS, factory);
+ } catch (ClassNotFoundException e) {
+ log.error("PDF Signer Factory not found", e);
+ throw new RuntimeException("PDF Signer Factory not found", e);
+ } catch (InstantiationException e) {
+ log.error("PDF Signer Factory could not be instantiated", e);
+ throw new RuntimeException("PDF Signer Factory could not be instantiated", e);
+ } catch (IllegalAccessException e) {
+ log.error("PDF Signer Factory could not accessed", e);
+ throw new RuntimeException("PDF Signer Factory could not accessed", e);
+ }
+ }
+
+ private static void registerSigner(Signers signer, SignerFactory factory) {
+ factoryMap.put(signer, factory);
+ }
+
+ /**
+ * Gets a PDF Signer according to the chosen signer library
+ * @param signer the chosen Signer type
+ * @return the PDF Signer
+ */
+ public static Signer getSigner(Signers signer) {
+ return factoryMap.get(signer).createSigner();
+ }
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureDimension.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureDimension.java
new file mode 100644
index 00000000..8d47cb19
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureDimension.java
@@ -0,0 +1,69 @@
+package at.asit.pdfover.signator;
+
+/**
+ * The dimensions of the visible signature block
+ */
+public class SignatureDimension {
+
+ /**
+ * The visible Signature block width
+ */
+ protected int width;
+
+ /**
+ * The visible Signature block height
+ */
+ protected int height;
+
+ /**
+ * Constructor
+ * @param width The width of the signature block
+ * @param height The height of the signature block
+ */
+ public SignatureDimension(int width, int height) {
+ setDimension(width, height);
+ }
+
+ /**
+ * Sets the the dimension of the signature block
+ * @param width The width
+ * @param height The height
+ */
+ public void setDimension(int width, int height)
+ {
+ setWidth(width);
+ setHeight(height);
+ }
+
+ /**
+ * Sets the width for the dimension
+ * @param width
+ */
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ /**
+ * Gets the width of the visible Signature block
+ * @return the width
+ */
+ public int getWidth() {
+ return this.width;
+ }
+
+ /**
+ * Sets the height for the dimension
+ * @param height
+ */
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ /**
+ * Gets the height of the visible Signature block
+ * @return the height
+ */
+ public int getHeight() {
+ return this.height;
+ }
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureException.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureException.java
new file mode 100644
index 00000000..d41ba24d
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureException.java
@@ -0,0 +1,45 @@
+package at.asit.pdfover.signator;
+
+/**
+ * Base class for signature exceptions
+ */
+public class SignatureException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 711578398780816710L;
+
+
+ /**
+ * Empty constructor
+ */
+ public SignatureException() {
+ super();
+ }
+
+ /**
+ * Constructor with causing exception
+ * @param cause the cause
+ */
+ public SignatureException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructor with message
+ * @param msg the message
+ */
+ public SignatureException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Constructor with message and causing exception
+ * @param message the message
+ * @param cause the cause
+ */
+ public SignatureException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java
new file mode 100644
index 00000000..3fa9c7ce
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignatureParameter.java
@@ -0,0 +1,117 @@
+package at.asit.pdfover.signator;
+
+/**
+ * The Signature Parameter
+ */
+public abstract class SignatureParameter {
+
+ /**
+ * The Signature Position
+ * @uml.property name="signaturePosition"
+ * @uml.associationEnd
+ */
+ protected SignaturePosition signaturePosition = null;
+
+ /**
+ * The signature Device
+ */
+ protected String keyIdentifier = null;
+
+ /**
+ * The input document
+ * @uml.property name="documentSource"
+ * @uml.associationEnd
+ */
+ protected DocumentSource documentSource = null;
+
+ /**
+ * holds the collimating mark
+ * @uml.property name="collimark"
+ * @uml.associationEnd
+ */
+ protected Emblem emblem;
+
+ /**
+ * Getter of the property <tt>signaturePosition</tt>
+ * @return Returns the signaturePosition.
+ */
+ public SignaturePosition getSignaturePosition() {
+ return this.signaturePosition;
+ }
+
+ /**
+ * Setter of the property <tt>signaturePosition</tt>
+ * @param signaturePosition The signaturePosition to set.
+ */
+ public void setSignaturePosition(SignaturePosition signaturePosition) {
+ this.signaturePosition = signaturePosition;
+ }
+
+ /**
+ * Getter of the property <tt>keyIdentifier</tt>
+ * @return Returns the keyIdentifier.
+ */
+ public String getKeyIdentifier() {
+ return this.keyIdentifier;
+ }
+
+ /**
+ * Setter of the property <tt>keyIdentifier</tt>
+ * @param keyIdentifier The keyIdentifier to set.
+ */
+ public void setKeyIdentifier(String keyIdentifier) {
+ this.keyIdentifier = keyIdentifier;
+ }
+
+ /**
+ * Getter of the property <tt>documentSource</tt>
+ * @return Returns the documentSource.
+ */
+ public DocumentSource getInputDocument() {
+ return this.documentSource;
+ }
+
+ /**
+ * Setter of the property <tt>documentSource</tt>
+ * @param inputDocument The documentSource to set.
+ */
+ public void setInputDocument(DocumentSource inputDocument) {
+ this.documentSource = inputDocument;
+ }
+
+ /**
+ * Gets the Dimension to display the Placeholder
+ * @return the placeholder dimensions
+ */
+ public abstract SignatureDimension getPlaceholderDimension();
+
+ /**
+ * Gets the Emblem
+ * @return the Emblem
+ */
+ public Emblem getEmblem() {
+ return this.emblem;
+ }
+
+ /**
+ * Sets the Emblem
+ * @param emblem The new Emblem
+ */
+ public void setEmblem(Emblem emblem) {
+ this.emblem = emblem;
+ }
+
+ /**
+ * Sets generic properties
+ * @param key
+ * @param value
+ */
+ public abstract void setProperty(String key, String value);
+
+ /**
+ * Gets generic properties
+ * @param key
+ * @return associated value
+ */
+ public abstract String getProperty(String key);
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignaturePosition.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignaturePosition.java
new file mode 100644
index 00000000..59fa4864
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignaturePosition.java
@@ -0,0 +1,107 @@
+package at.asit.pdfover.signator;
+
+
+/**
+ * Represents the position of a visible signature block
+ */
+public class SignaturePosition {
+ /**
+ * The x value of the position
+ */
+ protected float x = 0;
+
+ /**
+ * The y value of the position
+ */
+ protected float y = 0;
+
+ /**
+ * The page value of the position
+ */
+ protected int page = 0;
+
+ /**
+ * Whether automatic positioning is used
+ */
+ protected boolean autoPositioning;
+
+ /**
+ * Default constructor
+ * No position given, hence automatic positioning will be used
+ */
+ public SignaturePosition() {
+ this.autoPositioning = true;
+ }
+
+ /**
+ * X - Y Constructor (Page = 0)
+ * @param x The x value of the position
+ * @param y The y value of the position
+ */
+ public SignaturePosition(float x, float y) {
+ this.autoPositioning = false;
+ setPosition(x, y);
+ }
+
+ /**
+ * Constructor
+ * @param x The x value of the signature position
+ * @param y The y value of the signature position
+ * @param page The page value of the signature position
+ */
+ public SignaturePosition(float x, float y, int page) {
+ this.autoPositioning = false;
+ setPosition(x, y);
+ setPage(page);
+ }
+
+ /**
+ * Sets new position
+ * @param x the new x value
+ * @param y the new y value
+ */
+ public void setPosition(float x, float y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ /**
+ * Gets the X value of the position
+ * @return float the x value of the position
+ */
+ public float getX() {
+ return this.x;
+ }
+
+ /**
+ * Gets the Y value of the position
+ * @return float the y value of the position
+ */
+ public float getY() {
+ return this.y;
+ }
+
+ /**
+ * Sets Page value of position
+ * @param page the new page value
+ */
+ public void setPage(int page) {
+ this.page = page;
+ }
+
+ /**
+ * Gets the Page value of the position
+ * @return int the page value of the position
+ */
+ public int getPage() {
+ return this.page;
+ }
+
+ /**
+ * Gets whether automatic positioning is used
+ * @return true if the signature position is determined automatically
+ */
+ public boolean useAutoPositioning() {
+ return this.autoPositioning;
+ }
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signer.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signer.java
new file mode 100644
index 00000000..fd7bee09
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/Signer.java
@@ -0,0 +1,33 @@
+package at.asit.pdfover.signator;
+
+/**
+ * PDF Signer base Class
+ * This class should be extended to support libraries such as PDF-AS or PADES.
+ */
+public interface Signer {
+
+ /**
+ * Prepare a signature
+ * Defines signature parameters, the pdf library prepares the pdf document to sign and
+ * creates a Security Layer Request.
+ * @param parameter The signature parameters
+ * @return The signing state (contains the prepared document and the signature request
+ * @throws SignatureException
+ */
+ public SigningState prepare(SignatureParameter parameter) throws SignatureException;
+
+ /**
+ * Adds the signature to the document.
+ * The SL Response has to be set in the state
+ * @param state The signing state
+ * @return The signature Result
+ * @throws SignatureException
+ */
+ public SignResult sign(SigningState state) throws SignatureException;
+
+ /**
+ * Creates new signing profile
+ * @return The new Profile
+ */
+ public SignatureParameter newParameter();
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignerFactory.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignerFactory.java
new file mode 100644
index 00000000..6c0b6487
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SignerFactory.java
@@ -0,0 +1,15 @@
+package at.asit.pdfover.signator;
+
+import at.asit.pdfover.signator.Signer;
+
+/**
+ * A Signer factory
+ * Creates Signer instances
+ */
+public abstract class SignerFactory {
+ /**
+ * Create a Signer
+ * @return the new Signer
+ */
+ public abstract Signer createSigner();
+}
diff --git a/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SigningState.java b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SigningState.java
new file mode 100644
index 00000000..c1e82da3
--- /dev/null
+++ b/pdf-over-signator/src/main/java/at/asit/pdfover/signator/SigningState.java
@@ -0,0 +1,19 @@
+package at.asit.pdfover.signator;
+
+/**
+ * The state of the pdf signing library
+ */
+public interface SigningState {
+
+ /**
+ * Gets the Security Layer Request to create the signature
+ * @return The Signature Request
+ */
+ public abstract SLRequest getSignatureRequest();
+
+ /**
+ * Sets the Security Layer Response to the Signature Request
+ * @param value The Signature Response
+ */
+ public abstract void setSignatureResponse(SLResponse value);
+}