summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatorInterface.java2
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/ByteArrayDocumentSource.java29
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/DocumentSource.java22
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignatureException.java9
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerInterface.java6
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLResponse.java11
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResult.java4
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResultImpl.java37
-rw-r--r--pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignaturePosition.java37
-rw-r--r--pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/ByteArrayPdfAsDataSource.java36
-rw-r--r--pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASHelper.java73
-rw-r--r--pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSLRequest.java18
-rw-r--r--pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSignatureParameter.java25
-rw-r--r--pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSigner.java151
-rw-r--r--pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSigningState.java81
15 files changed, 520 insertions, 21 deletions
diff --git a/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatorInterface.java b/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatorInterface.java
index 094d7523..9fc21eb8 100644
--- a/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatorInterface.java
+++ b/pdf-over/pdf-signator-interface/src/main/java/at/asit/pdfover/pdfsignator/PDFSignatorInterface.java
@@ -3,8 +3,6 @@
*/
package at.asit.pdfover.pdfsignator;
-import java.security.SignatureException;
-
import at.asit.pdfover.pdfsigner.PDFSignatureException;
import at.asit.pdfover.pdfsigner.SignResult;
import at.asit.pdfover.pdfsigner.SignatureParameter;
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/ByteArrayDocumentSource.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/ByteArrayDocumentSource.java
new file mode 100644
index 00000000..27e0c537
--- /dev/null
+++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/ByteArrayDocumentSource.java
@@ -0,0 +1,29 @@
+package at.asit.pdfover.pdfsigner;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+public class ByteArrayDocumentSource implements DocumentSource {
+
+ protected byte[] data;
+
+ public ByteArrayDocumentSource(byte[] data) {
+ this.data = data;
+ }
+
+ @Override
+ public InputStream GetInputStream() {
+ return new ByteArrayInputStream(this.data);
+ }
+
+ @Override
+ public int GetLength() {
+ return data.length;
+ }
+
+ @Override
+ public byte[] GetByteArray() {
+ return data;
+ }
+
+}
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/DocumentSource.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/DocumentSource.java
index af377c44..dafe9797 100644
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/DocumentSource.java
+++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/DocumentSource.java
@@ -1,9 +1,29 @@
package at.asit.pdfover.pdfsigner;
+import java.io.InputStream;
+
/**
* A Document Source
+ *
* @author afitzek
*/
-public class DocumentSource {
+public interface DocumentSource {
+
+ /**
+ * Gets Document as INput Stream
+ * @return
+ */
+ public InputStream GetInputStream();
+
+ /**
+ * Get Length of document
+ * @return
+ */
+ public int GetLength();
+ /**
+ * Get byte[]
+ * @return
+ */
+ public byte[] GetByteArray();
}
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignatureException.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignatureException.java
index 19253af1..5a9a0073 100644
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignatureException.java
+++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignatureException.java
@@ -10,5 +10,12 @@ public class PDFSignatureException extends Exception {
*
*/
private static final long serialVersionUID = 711578398780816710L;
-
+
+ public PDFSignatureException(Throwable e) {
+ super(e);
+ }
+
+ public PDFSignatureException(String msg) {
+ super(msg);
+ }
}
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerInterface.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerInterface.java
index 6c8aa83b..0d9592dc 100644
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerInterface.java
+++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/PDFSignerInterface.java
@@ -1,7 +1,5 @@
package at.asit.pdfover.pdfsigner;
-import java.security.SignatureException;
-
/**
* PDF Signator base Class
* This class should be extended to support PDF-AS and PADES.
@@ -17,7 +15,7 @@ public interface PDFSignerInterface {
* @return The siging state (contains the prepared document and the signature request
* @throws SignatureException
*/
- public SigningState Prepare(SignatureParameter parameter) throws SignatureException;
+ public SigningState Prepare(SignatureParameter parameter) throws PDFSignatureException;
/**
* Adds the signature to the document.
@@ -26,7 +24,7 @@ public interface PDFSignerInterface {
* @return The signature Result
* @throws SignatureException
*/
- public SignResult Sign(SigningState state) throws SignatureException;
+ public SignResult Sign(SigningState state) throws PDFSignatureException;
/**
* Creates new signing profile
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLResponse.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLResponse.java
index 4d2e594a..de98aa1a 100644
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLResponse.java
+++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SLResponse.java
@@ -5,5 +5,14 @@ package at.asit.pdfover.pdfsigner;
* @author afitzek
*/
public class SLResponse {
-
+
+ private String response;
+
+ public SLResponse(String value) {
+ response = value;
+ }
+
+ public String GetSLRespone() {
+ return this.response;
+ }
}
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResult.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResult.java
index 6357fe11..8069da4e 100644
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResult.java
+++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResult.java
@@ -1,6 +1,6 @@
package at.asit.pdfover.pdfsigner;
-import javax.security.cert.Certificate;
+import java.security.cert.X509Certificate;
/**
* Signature Result containing the signed document as document source
@@ -24,5 +24,5 @@ public interface SignResult {
* Gets the signer certificate
* @return The signer x509 certificate
*/
- public Certificate GetSignerCertificate();
+ public X509Certificate GetSignerCertificate();
}
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResultImpl.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResultImpl.java
new file mode 100644
index 00000000..433ad093
--- /dev/null
+++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignResultImpl.java
@@ -0,0 +1,37 @@
+package at.asit.pdfover.pdfsigner;
+
+import java.security.cert.X509Certificate;
+
+public class SignResultImpl implements SignResult {
+
+ private SignaturePosition position;
+ private DocumentSource source;
+ private X509Certificate certificate;
+
+ @Override
+ public SignaturePosition GetSignaturePosition() {
+ return position;
+ }
+
+ @Override
+ public DocumentSource GetSignedDocument() {
+ return source;
+ }
+
+ @Override
+ public X509Certificate GetSignerCertificate() {
+ return certificate;
+ }
+
+ public void SetSignerCertificate(X509Certificate x509Certificate) {
+ this.certificate = x509Certificate;
+ }
+
+ public void SetSignaturePosition(SignaturePosition postion) {
+ this.position = postion;
+ }
+
+ public void SetSignedDocument(DocumentSource source) {
+ this.source = source;
+ }
+}
diff --git a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignaturePosition.java b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignaturePosition.java
index f6d2aa81..82f37deb 100644
--- a/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignaturePosition.java
+++ b/pdf-over/pdf-signer-interface/src/main/java/at/asit/pdfover/pdfsigner/SignaturePosition.java
@@ -9,18 +9,20 @@ public class SignaturePosition {
/**
* The x value of the position
*/
- protected int x = 0;
+ protected float x = 0;
/**
* The y value of the position
*/
- protected int y = 0;
+ protected float y = 0;
/**
* The page value of the position
*/
protected int page = 1;
+ protected boolean auto = true;
+
/**
* Default constructor
*/
@@ -32,7 +34,7 @@ public class SignaturePosition {
* @param x The x value of the position
* @param y The y value of the position
*/
- public SignaturePosition(int x, int y) {
+ public SignaturePosition(float x, float y) {
this.x = x;
this.y = y;
}
@@ -43,7 +45,7 @@ public class SignaturePosition {
* @param y The y value of the position
* @param page The page value of the position
*/
- public SignaturePosition(int x, int y, int page) {
+ public SignaturePosition(float x, float y, int page) {
this.x = x;
this.y = y;
this.page = page;
@@ -53,15 +55,15 @@ public class SignaturePosition {
* Sets X value of position
* @param value the new x value
*/
- public void SetX(int value) {
+ public void SetX(float value) {
this.x = value;
}
/**
* Gets the X value of the position
- * @return int the x value of the position
+ * @return float the x value of the position
*/
- public int GetX() {
+ public float GetX() {
return this.x;
}
@@ -69,15 +71,15 @@ public class SignaturePosition {
* Sets Y value of position
* @param value the new y value
*/
- public void SetY(int value) {
+ public void SetY(float value) {
this.y = value;
}
/**
* Gets the Y value of the position
- * @return int the y value of the position
+ * @return float the y value of the position
*/
- public int GetY() {
+ public float GetY() {
return this.y;
}
@@ -97,4 +99,19 @@ public class SignaturePosition {
return this.page;
}
+ /**
+ * Sets Page value of position
+ * @param value the new page value
+ */
+ public void SetAuto(boolean value) {
+ this.auto = value;
+ }
+
+ /**
+ * Gets the Page value of the position
+ * @return int the page value of the position
+ */
+ public boolean GetAuto() {
+ return this.auto;
+ }
}
diff --git a/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/ByteArrayPdfAsDataSource.java b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/ByteArrayPdfAsDataSource.java
new file mode 100644
index 00000000..874a08e9
--- /dev/null
+++ b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/ByteArrayPdfAsDataSource.java
@@ -0,0 +1,36 @@
+package at.asit.pdfover.pdfsigner.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;
+ }
+
+ public InputStream createInputStream() {
+ return new ByteArrayInputStream(this.data);
+ }
+
+ public int getLength() {
+ return this.data.length;
+ }
+
+ public byte[] getAsByteArray() {
+ return this.data;
+ }
+
+ public String getMimeType() {
+ return "application/pdf";
+ }
+
+ public String getCharacterEncoding() {
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASHelper.java b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASHelper.java
new file mode 100644
index 00000000..1e14fc39
--- /dev/null
+++ b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASHelper.java
@@ -0,0 +1,73 @@
+package at.asit.pdfover.pdfsigner.pdfas;
+
+import at.asit.pdfover.pdfsigner.PDFSignatureException;
+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 pdf_as_instance = null;
+
+ /**
+ * Internal Pdf AS Object
+ */
+ private static PdfAsInternal pdf_as_internal = 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
+ * @throws PdfAsException
+ */
+ private static PdfAsInternal CreatePdfAsInternal() throws PdfAsException {
+ return new at.gv.egiz.pdfas.impl.api.internal.PdfAsInternalObject();
+ }
+
+ /**
+ * Gets PDF AS Object
+ * @return
+ * @throws PDFSignatureException
+ */
+ public static synchronized PdfAs GetPdfAs() throws PDFSignatureException {
+ if(pdf_as_instance == null) {
+ try {
+ pdf_as_instance = CreatePdfAs();
+ } catch(PdfAsException e) {
+ throw new PDFSignatureException(e);
+ }
+ }
+ return pdf_as_instance;
+ }
+
+ /**
+ * Gets PDF AS Internal object
+ * @return
+ * @throws PDFSignatureException
+ */
+ public static synchronized PdfAsInternal GetPdfAsInternal() throws PDFSignatureException {
+ if(pdf_as_internal == null) {
+ try {
+ pdf_as_internal = CreatePdfAsInternal();
+ } catch(PdfAsException e) {
+ throw new PDFSignatureException(e);
+ }
+ }
+ return pdf_as_internal;
+ }
+}
diff --git a/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSLRequest.java b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSLRequest.java
new file mode 100644
index 00000000..a4b55c94
--- /dev/null
+++ b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSLRequest.java
@@ -0,0 +1,18 @@
+package at.asit.pdfover.pdfsigner.pdfas;
+
+import at.asit.pdfover.pdfsigner.DocumentSource;
+import at.asit.pdfover.pdfsigner.SLRequest;
+
+public class PDFASSLRequest implements SLRequest {
+
+ public PDFASSLRequest(String slRequest) {
+ /// Analyse Request ...
+ }
+
+ @Override
+ public DocumentSource GetSignatureData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSignatureParameter.java b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSignatureParameter.java
new file mode 100644
index 00000000..518f54b7
--- /dev/null
+++ b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSignatureParameter.java
@@ -0,0 +1,25 @@
+package at.asit.pdfover.pdfsigner.pdfas;
+
+import at.asit.pdfover.pdfsigner.SignatureDimension;
+import at.asit.pdfover.pdfsigner.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);
+ }
+}
diff --git a/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSigner.java b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSigner.java
new file mode 100644
index 00000000..f94f3fdf
--- /dev/null
+++ b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSigner.java
@@ -0,0 +1,151 @@
+package at.asit.pdfover.pdfsigner.pdfas;
+
+import at.asit.pdfover.pdfsigner.ByteArrayDocumentSource;
+import at.asit.pdfover.pdfsigner.PDFSignatureException;
+import at.asit.pdfover.pdfsigner.PDFSignerInterface;
+import at.asit.pdfover.pdfsigner.SignResult;
+import at.asit.pdfover.pdfsigner.SignResultImpl;
+import at.asit.pdfover.pdfsigner.SignatureParameter;
+import at.asit.pdfover.pdfsigner.SignaturePosition;
+import at.asit.pdfover.pdfsigner.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 Implemtation
+ *
+ * @author afitzek
+ */
+public class PDFASSigner implements PDFSignerInterface {
+
+ protected static final String PROFILE_ID = "";
+
+ protected static final String URL_TEMPLATE = "";
+
+ @Override
+ public SigningState Prepare(SignatureParameter parameter)
+ throws PDFSignatureException {
+ try {
+ PDFASSignatureParameter sign_para = null;
+
+ if (PDFASSignatureParameter.class.isInstance(parameter)) {
+ sign_para = PDFASSignatureParameter.class.cast(parameter);
+ }
+
+ if (sign_para == null) {
+ throw new PDFSignatureException("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.GetCollimatingMark() != null) {
+ // TODO: Define CollimatingMark and use
+ params.setProfileOverrideValue("SIG_LABEL", "./images/signatur-logo_en.png");
+ }
+
+
+ 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.SetSLSignatureRequest(request);
+
+ return state;
+ } catch (PdfAsException e) {
+ throw new PDFSignatureException(e);
+ }
+ }
+
+ @Override
+ public SignResult Sign(SigningState state) throws PDFSignatureException {
+ try {
+ PDFASSigningState sstate = null;
+
+ if (PDFASSigningState.class.isInstance(state)) {
+ sstate = PDFASSigningState.class.cast(state);
+ }
+
+ if (sstate == null) {
+ throw new PDFSignatureException("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
+ // TODO: NEED TO check GetSLSignatureResponse() Interface to retrieve SL Response ...
+ at.gv.egiz.pdfas.api.sign.SignResult signResult = pdfasInternal
+ .finishLocalSign(pdfas, params, sdi, bkuParams, false,
+ sstate.GetSLSignatureResponse().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().GetAuto());
+ result.SetSignaturePosition(pos);
+
+ // Set signed Document
+ result.SetSignedDocument(new ByteArrayDocumentSource(data.getData()));
+
+ return result;
+ } catch (PdfAsException e) {
+ throw new PDFSignatureException(e);
+ }
+ }
+
+ @Override
+ public SignatureParameter GetParameter() {
+ return new PDFASSignatureParameter();
+ }
+
+}
diff --git a/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSigningState.java b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSigningState.java
new file mode 100644
index 00000000..9500f981
--- /dev/null
+++ b/pdf-over/pdf-signer-pdf-as/src/main/java/at/asit/pdfover/pdfsigner/pdfas/PDFASSigningState.java
@@ -0,0 +1,81 @@
+package at.asit.pdfover.pdfsigner.pdfas;
+
+import at.asit.pdfover.pdfsigner.SLRequest;
+import at.asit.pdfover.pdfsigner.SLResponse;
+import at.asit.pdfover.pdfsigner.SigningState;
+import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation;
+
+/**
+ * Signing State for PDFAS Wrapper
+ * @author afitzek
+ */
+public class PDFASSigningState implements SigningState {
+
+ protected SLRequest slrequest;
+
+ protected SLResponse slresponse;
+
+ @Override
+ public SLRequest GetSLSignatureRequest() {
+ return slrequest;
+ }
+
+ @Override
+ public void SetSLSignatureResponse(SLResponse value) {
+ this.slresponse = value;
+ }
+
+ /**
+ * Sets the SL Request
+ * @param request The SL Request
+ */
+ public void SetSLSignatureRequest(SLRequest request) {
+ this.slrequest = request;
+ }
+
+ /**
+ * Gets the SL Response
+ * @return The SL Repsonse object
+ */
+ public SLResponse GetSLSignatureResponse() {
+ 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) {
+ PDFAsSignatureParameter = pDFAsSignatureParameter;
+ }
+
+ public at.gv.egiz.pdfas.api.sign.SignParameters getSignParameters() {
+ return SignParameters;
+ }
+
+ public void setSignParameters(
+ at.gv.egiz.pdfas.api.sign.SignParameters signParameters) {
+ SignParameters = signParameters;
+ }
+
+ public SignatureDetailInformation getSignatureDetailInformation() {
+ return SignatureDetailInformation;
+ }
+
+ public void setSignatureDetailInformation(
+ SignatureDetailInformation signatureDetailInformation) {
+ SignatureDetailInformation = signatureDetailInformation;
+ }
+}