summaryrefslogtreecommitdiff
path: root/trunk/pdf-over-signer/pdf-over-sigpdfas
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/pdf-over-signer/pdf-over-sigpdfas')
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/.classpath10
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/.project23
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.core.resources.prefs7
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.jdt.core.prefs98
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.m2e.core.prefs5
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.mylyn.tasks.ui.prefs4
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/pom.xml24
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java42
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java73
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java18
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java151
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSignerFactory.java12
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigningState.java87
-rw-r--r--trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java37
14 files changed, 591 insertions, 0 deletions
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/.classpath b/trunk/pdf-over-signer/pdf-over-sigpdfas/.classpath
new file mode 100644
index 00000000..0f53f3e2
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/.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/trunk/pdf-over-signer/pdf-over-sigpdfas/.project b/trunk/pdf-over-signer/pdf-over-sigpdfas/.project
new file mode 100644
index 00000000..a8f28341
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>pdf-over-sigpdfas</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/trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.core.resources.prefs b/trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000..7f5422a4
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/.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/trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.jdt.core.prefs b/trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..3e73d18e
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/.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/trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.m2e.core.prefs b/trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 00000000..62e91186
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/.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/trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.mylyn.tasks.ui.prefs b/trunk/pdf-over-signer/pdf-over-sigpdfas/.settings/org.eclipse.mylyn.tasks.ui.prefs
new file mode 100644
index 00000000..c6aa7359
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/.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/trunk/pdf-over-signer/pdf-over-sigpdfas/pom.xml b/trunk/pdf-over-signer/pdf-over-sigpdfas/pom.xml
new file mode 100644
index 00000000..7a1122ea
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/pom.xml
@@ -0,0 +1,24 @@
+<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>a-sit.at</groupId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>pdf-over-sigpdfas</artifactId>
+ <name>PDF-Over PDF-AS Signer</name>
+ <dependencies>
+ <dependency>
+ <groupId>a-sit.at</groupId>
+ <artifactId>pdf-over-signator</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>knowcenter</groupId>
+ <artifactId>pdf-as</artifactId>
+ <version>3.2</version>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java
new file mode 100644
index 00000000..0fa23192
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java
@@ -0,0 +1,42 @@
+package at.asit.pdfover.signer.pdfas;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import at.gv.egiz.pdfas.api.io.DataSource;
+
+public class ByteArrayPDFASDataSource implements DataSource {
+
+ private byte[] data;
+
+ public ByteArrayPDFASDataSource(byte[] data) {
+ this.data = data;
+ }
+
+ @Override
+ public InputStream createInputStream() {
+ return new ByteArrayInputStream(this.data);
+ }
+
+ @Override
+ public int getLength() {
+ return this.data.length;
+ }
+
+ @Override
+ public byte[] getAsByteArray() {
+ return this.data;
+ }
+
+ @Override
+ public String getMimeType() {
+ return "application/pdf";
+ }
+
+ @Override
+ public String getCharacterEncoding() {
+ //TODO
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java
new file mode 100644
index 00000000..756478d3
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASHelper.java
@@ -0,0 +1,73 @@
+package at.asit.pdfover.signer.pdfas;
+
+import at.asit.pdfover.signator.SignatureException;
+import at.gv.egiz.pdfas.api.PdfAs;
+import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
+import at.gv.egiz.pdfas.api.internal.PdfAsInternal;
+
+/**
+ * Encapsulates PDF AS API Object to need just one initialization
+ * @author afitzek
+ */
+public class PDFASHelper {
+
+ /**
+ * PDF AS Object
+ */
+ private static PdfAs pdfAs = null;
+
+ /**
+ * Internal Pdf AS Object
+ */
+ private static PdfAsInternal pdfAsInternal = null;
+
+ /**
+ * Creates PDF AS Object
+ * @return
+ * @throws PdfAsException
+ */
+ private static PdfAs createPdfAs() throws PdfAsException {
+ return new at.gv.egiz.pdfas.impl.api.PdfAsObject();
+ }
+
+ /**
+ * Creates a PDF-AS Internal object
+ * @return the PDF-AS Internal object
+ * @throws PdfAsException
+ */
+ private static PdfAsInternal createPdfAsInternal() throws PdfAsException {
+ return new at.gv.egiz.pdfas.impl.api.internal.PdfAsInternalObject();
+ }
+
+ /**
+ * 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(PdfAsException e) {
+ throw new SignatureException(e);
+ }
+ }
+ return pdfAs;
+ }
+
+ /**
+ * Gets PDF-AS Internal object
+ * @return the PDF-AS Internal object
+ * @throws SignatureException
+ */
+ public static synchronized PdfAsInternal getPdfAsInternal() throws SignatureException {
+ if(pdfAsInternal == null) {
+ try {
+ pdfAsInternal = createPdfAsInternal();
+ } catch(PdfAsException e) {
+ throw new SignatureException(e);
+ }
+ }
+ return pdfAsInternal;
+ }
+}
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java
new file mode 100644
index 00000000..7130f53a
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java
@@ -0,0 +1,18 @@
+package at.asit.pdfover.signer.pdfas;
+
+import at.asit.pdfover.signator.DocumentSource;
+import at.asit.pdfover.signator.SLRequest;
+
+public class PDFASSLRequest implements SLRequest {
+
+ public PDFASSLRequest(String slRequest) {
+ /// Analyze Request ...
+ }
+
+ @Override
+ public DocumentSource getSignatureData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java
new file mode 100644
index 00000000..949bbce1
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java
@@ -0,0 +1,151 @@
+package at.asit.pdfover.signer.pdfas;
+
+import at.asit.pdfover.signator.ByteArrayDocumentSource;
+import at.asit.pdfover.signator.SignatureException;
+import at.asit.pdfover.signator.Signer;
+import at.asit.pdfover.signator.SignResult;
+import at.asit.pdfover.signator.SignResultImpl;
+import at.asit.pdfover.signator.SignatureParameter;
+import at.asit.pdfover.signator.SignaturePosition;
+import at.asit.pdfover.signator.SigningState;
+import at.gv.egiz.pdfas.api.PdfAs;
+import at.gv.egiz.pdfas.api.sign.SignParameters;
+import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation;
+import at.gv.egiz.pdfas.io.ByteArrayDataSink;
+import at.gv.egiz.pdfas.api.commons.Constants;
+import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
+import at.gv.egiz.pdfas.api.internal.LocalBKUParams;
+import at.gv.egiz.pdfas.api.internal.PdfAsInternal;
+
+/**
+ * PDF AS Signer Implementation
+ */
+public class PDFASSigner implements Signer {
+
+ /**
+ * The profile ID
+ */
+ protected static final String PROFILE_ID = "SIGNATURBLOCK_DE";
+
+ /**
+ * The template URL
+ */
+ protected static final String URL_TEMPLATE = "http://pdfover.4.gv.at/template";
+
+ @Override
+ public SigningState prepare(SignatureParameter parameter)
+ throws SignatureException {
+ try {
+ PdfAsSignatureParameter sign_para = null;
+
+ if (PdfAsSignatureParameter.class.isInstance(parameter)) {
+ sign_para = PdfAsSignatureParameter.class.cast(parameter);
+ }
+
+ if (sign_para == null) {
+ throw new SignatureException("Incorrect SignatureParameter!");
+ }
+
+ PdfAs pdfas = PDFASHelper.getPdfAs();
+
+ PDFASSigningState state = new PDFASSigningState();
+
+ SignParameters params = new SignParameters();
+ params.setSignaturePositioning(sign_para.getPDFASPositioning());
+ params.setSignatureDevice(Constants.SIGNATURE_DEVICE_BKU);
+ params.setSignatureType(Constants.SIGNATURE_TYPE_BINARY);
+ params.setSignatureProfileId(PROFILE_ID);
+
+ if (parameter.getEmblem() != null) {
+ params.setProfileOverrideValue("SIG_LABEL", parameter
+ .getEmblem().getFileName());
+ }
+
+ params.setDocument(sign_para.getPDFASDataSource());
+
+ state.setSignParameters(params);
+
+ PdfAsInternal pdfasInternal = PDFASHelper.getPdfAsInternal();
+
+ // Prepares the document
+ SignatureDetailInformation sdi = pdfas.prepareSign(params);
+
+ state.setSignatureDetailInformation(sdi);
+
+ // Retrieve the SL Request
+ String slRequest = pdfasInternal.prepareLocalSignRequest(params,
+ false, URL_TEMPLATE, sdi);
+
+ PDFASSLRequest request = new PDFASSLRequest(slRequest);
+
+ state.setSignatureRequest(request);
+
+ return state;
+ } catch (PdfAsException e) {
+ throw new SignatureException(e);
+ }
+ }
+
+ @Override
+ public SignResult sign(SigningState state) throws SignatureException {
+ try {
+ PDFASSigningState sstate = null;
+
+ if (PDFASSigningState.class.isInstance(state)) {
+ sstate = PDFASSigningState.class.cast(state);
+ }
+
+ if (sstate == null) {
+ throw new SignatureException("Incorrect SigningState!");
+ }
+
+ // Retrieve objects
+ PdfAs pdfas = PDFASHelper.getPdfAs();
+
+ PdfAsInternal pdfasInternal = PDFASHelper.getPdfAsInternal();
+
+ SignParameters params = sstate.getSignParameters();
+
+ // Prepare Output sink
+ ByteArrayDataSink data = new ByteArrayDataSink();
+ params.setOutput(data);
+
+ SignatureDetailInformation sdi = sstate
+ .getSignatureDetailInformation();
+
+ LocalBKUParams bkuParams = new LocalBKUParams(null, null, null);
+
+ // Perform signature
+ at.gv.egiz.pdfas.api.sign.SignResult signResult = pdfasInternal
+ .finishLocalSign(pdfas, params, sdi, bkuParams, false,
+ sstate.getSignatureResponse().getSLRespone());
+
+ // Preparing Result Response
+ SignResultImpl result = new SignResultImpl();
+
+ // Set Signer Certificate
+ result.setSignerCertificate(signResult.getSignerCertificate());
+ at.gv.egiz.pdfas.api.sign.pos.SignaturePosition pdfasPos = signResult
+ .getSignaturePosition();
+
+ // Set Signature position
+ SignaturePosition pos = new SignaturePosition(pdfasPos.getX(),
+ pdfasPos.getY(), pdfasPos.getPage());
+/* pos.SetAuto(sstate.getPDFAsSignatureParameter()
+ .getSignaturePosition().useAutoPositioning());*/
+ result.setSignaturePosition(pos);
+
+ // Set signed Document
+ result.setSignedDocument(new ByteArrayDocumentSource(data.getData()));
+
+ return result;
+ } catch (PdfAsException e) {
+ throw new SignatureException(e);
+ }
+ }
+
+ @Override
+ public SignatureParameter newParameter() {
+ return new PdfAsSignatureParameter();
+ }
+}
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSignerFactory.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSignerFactory.java
new file mode 100644
index 00000000..eaf9637f
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSignerFactory.java
@@ -0,0 +1,12 @@
+package at.asit.pdfover.signer.pdfas;
+
+import at.asit.pdfover.signator.Signer;
+import at.asit.pdfover.signator.SignerFactory;
+
+public class PDFASSignerFactory extends SignerFactory {
+
+ @Override
+ public Signer createSigner() {
+ return new PDFASSigner();
+ }
+}
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigningState.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigningState.java
new file mode 100644
index 00000000..8b8216c6
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigningState.java
@@ -0,0 +1,87 @@
+package at.asit.pdfover.signer.pdfas;
+
+import at.asit.pdfover.signator.SLRequest;
+import at.asit.pdfover.signator.SLResponse;
+import at.asit.pdfover.signator.SigningState;
+import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation;
+
+/**
+ * Signing State for PDFAS Wrapper
+ * @author afitzek
+ */
+public class PDFASSigningState implements SigningState {
+
+ /**
+ * The Signature Layer request
+ */
+ protected SLRequest slrequest;
+
+ /**
+ * The Signature Layer response
+ */
+ protected SLResponse slresponse;
+
+ @Override
+ public SLRequest getSignatureRequest() {
+ return this.slrequest;
+ }
+
+ @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 Repsonse object
+ */
+ public SLResponse getSignatureResponse() {
+ return this.slresponse;
+ }
+
+
+ // ----------------------------------------
+ // PDF AS Specific stuff
+ // ----------------------------------------
+
+ protected SignatureDetailInformation signatureDetailInformation;
+
+ protected at.gv.egiz.pdfas.api.sign.SignParameters signParameters;
+
+ protected PdfAsSignatureParameter pdfAsSignatureParameter;
+
+ public PdfAsSignatureParameter getPdfAsSignatureParameter() {
+ return pdfAsSignatureParameter;
+ }
+
+ public void setPdfAsSignatureParameter(
+ PdfAsSignatureParameter pdfAsSignatureParameter) {
+ this.pdfAsSignatureParameter = pdfAsSignatureParameter;
+ }
+
+ public at.gv.egiz.pdfas.api.sign.SignParameters getSignParameters() {
+ return signParameters;
+ }
+
+ public void setSignParameters(
+ at.gv.egiz.pdfas.api.sign.SignParameters signParameters) {
+ this.signParameters = signParameters;
+ }
+
+ public SignatureDetailInformation getSignatureDetailInformation() {
+ return signatureDetailInformation;
+ }
+
+ public void setSignatureDetailInformation(
+ SignatureDetailInformation signatureDetailInformation) {
+ this.signatureDetailInformation = signatureDetailInformation;
+ }
+}
diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java
new file mode 100644
index 00000000..7332a13e
--- /dev/null
+++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java
@@ -0,0 +1,37 @@
+package at.asit.pdfover.signer.pdfas;
+
+import at.asit.pdfover.signator.SignatureDimension;
+import at.asit.pdfover.signator.SignatureParameter;
+import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning;
+import at.gv.egiz.pdfas.api.io.DataSource;
+
+public class PdfAsSignatureParameter extends SignatureParameter {
+
+ @Override
+ public SignatureDimension getPlaceholderDimension() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public SignaturePositioning getPDFASPositioning() {
+ // TODO: implement Signature creation
+ return new SignaturePositioning();
+ }
+
+ public DataSource getPDFASDataSource() {
+ // TODO: implement Signature creation
+ return new ByteArrayPDFASDataSource(null);
+ }
+
+ @Override
+ public void setProperty(String key, String value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getProperty(String key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}