aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-04-12 15:58:14 +0200
committerAlexander Marsalek <amarsalek@iaik.tugraz.at>2021-04-12 15:58:14 +0200
commitc0f97e7b1ad5b6256eb935aeab06d159d68d1966 (patch)
treee014d891f58b87a5ca7dbb5c63e6334d9385c266
parentbc6073700024e4b3c95bcf5bf3e48efb6edd14ab (diff)
downloadpdf-as-4-c0f97e7b1ad5b6256eb935aeab06d159d68d1966.tar.gz
pdf-as-4-c0f97e7b1ad5b6256eb935aeab06d159d68d1966.tar.bz2
pdf-as-4-c0f97e7b1ad5b6256eb935aeab06d159d68d1966.zip
pdf-as-web signature block parameter handling
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignRequest.java16
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java3
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateAndRequestParameterResolver.java3
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/OperationStatus.java8
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/PDFObject.java6
-rw-r--r--pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java2
-rw-r--r--pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest1.java174
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java17
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java19
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java14
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java4
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java4
12 files changed, 238 insertions, 32 deletions
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignRequest.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignRequest.java
index 3e714ea9..39a384b2 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignRequest.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/api/ws/PDFASSignRequest.java
@@ -24,6 +24,8 @@
package at.gv.egiz.pdfas.api.ws;
import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@@ -40,6 +42,9 @@ public class PDFASSignRequest implements Serializable {
byte[] inputData;
PDFASSignParameters parameters;
VerificationLevel verificationLevel;
+
+ //map of user provided parameters, these values can be used in the signature block
+ Map<String,String> signatureBlockParameters;
@XmlElement(required = true, nillable = false, name="requestID")
public String getRequestID() {
@@ -76,4 +81,15 @@ public class PDFASSignRequest implements Serializable {
public void setParameters(PDFASSignParameters parameters) {
this.parameters = parameters;
}
+
+ @XmlElement(required = false, nillable = true, name="signatureBlockParameter")
+ public Map<String, String> getSignatureBlockParameters() {
+ if(signatureBlockParameters == null)
+ signatureBlockParameters = new HashMap<>();
+ return signatureBlockParameters;
+ }
+
+ public void setSignatureBlockParameters(Map<String, String> signatureBlockParameters) {
+ this.signatureBlockParameters = signatureBlockParameters;
+ }
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
index 55891bb2..b1165f59 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
@@ -148,7 +148,8 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants,
PDFObject pdfObject = signer.buildPDFObject(status);
//TODO verify map???
- pdfObject.getStatus().getRequestParameters().putAll(status.getSignParamter().getDynamicSignatureBlockArguments());
+
+// pdfObject.getStatus().getRequestParameters().putAll(status.getSignParamter().getDynamicSignatureBlockArguments());
status.setPdfObject(pdfObject);
// set Original PDF Document Data
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateAndRequestParameterResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateAndRequestParameterResolver.java
index 3fe8298b..bd7bb3a8 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateAndRequestParameterResolver.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateAndRequestParameterResolver.java
@@ -62,7 +62,8 @@ public class CertificateAndRequestParameterResolver implements IResolver {
this.ctx = new OgnlContext(null, null, memberAccess);
this.ctx = new OgnlContext(null, null, memberAccess);
- this.ctx.put(IProfileConstants.DYNAMIC_REQUEST_PARAMETERS, operationStatus.getRequestParameters());
+ this.ctx.put(IProfileConstants.DYNAMIC_REQUEST_PARAMETERS, operationStatus.getSignParamter().getDynamicSignatureBlockArguments());
+// this.ctx.put(IProfileConstants.DYNAMIC_REQUEST_PARAMETERS, operationStatus.getRequestParameters());
this.ctx.put("sn", this.certificate.getSerialNumber().toString());
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/OperationStatus.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/OperationStatus.java
index 08dcd249..898b7a00 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/OperationStatus.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/OperationStatus.java
@@ -56,7 +56,7 @@ public class OperationStatus implements Serializable {
private PDFASBackend backend;
private Map<String, String> metaInformations = new HashMap<String, String>();
- private HashMap<String, String> requestParameters = new HashMap<String, String>();
+// private HashMap<String, String> requestParameters = new HashMap<String, String>();
public OperationStatus(ISettings configuration, SignParameter signParameter, PDFASBackend backend) {
this.configuration = configuration;
@@ -177,7 +177,7 @@ public class OperationStatus implements Serializable {
return metaInformations;
}
- public HashMap<String, String> getRequestParameters() {
- return requestParameters;
- }
+// public HashMap<String, String> getRequestParameters() {
+// return requestParameters;
+// }
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/PDFObject.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/PDFObject.java
index 6722c69e..0b49aa90 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/PDFObject.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/status/PDFObject.java
@@ -25,6 +25,7 @@ package at.gv.egiz.pdfas.lib.impl.status;
import java.io.IOException;
import java.util.HashMap;
+import java.util.Map;
import javax.activation.DataSource;
@@ -71,7 +72,8 @@ public abstract class PDFObject {
public abstract String getPDFVersion();
- public HashMap<String, String> getRequestParameters() {
- return status.getRequestParameters();
+ public Map<String, String> getRequestParameters() {
+ return status.getSignParamter().getDynamicSignatureBlockArguments();
+// return status.getRequestParameters();//TODO alex
}
}
diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java
index 85981001..53eb9f80 100644
--- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java
+++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java
@@ -185,7 +185,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants {
SignatureProfileSettings signatureProfileSettings = TableFactory
.createProfile(requestedSignature.getSignatureProfileID(), pdfObject.getStatus().getSettings());
-
+
ValueResolver resolver = new ValueResolver(requestedSignature, pdfObject.getStatus());
String signerName = resolver.resolve("SIG_SUBJECT", signatureProfileSettings.getValue("SIG_SUBJECT"),
signatureProfileSettings);
diff --git a/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest1.java b/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest1.java
new file mode 100644
index 00000000..4ff9be0c
--- /dev/null
+++ b/pdf-as-web-client/src/test/java/at/gv/egiz/pdfas/web/client/test/SimpleTest1.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright>
+ * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
+ * joint initiative of the Federal Chancellery Austria and Graz University of
+ * Technology.
+ *
+ * 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://www.osor.eu/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.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ ******************************************************************************/
+package at.gv.egiz.pdfas.web.client.test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.commons.io.IOUtils;
+
+import at.gv.egiz.pdfas.api.ws.PDFASSignParameters;
+import at.gv.egiz.pdfas.api.ws.PDFASSignParameters.Connector;
+import at.gv.egiz.pdfas.api.ws.PDFASSignRequest;
+import at.gv.egiz.pdfas.api.ws.PDFASSignResponse;
+import at.gv.egiz.pdfas.api.ws.PDFASVerifyRequest;
+import at.gv.egiz.pdfas.api.ws.PDFASVerifyResponse;
+import at.gv.egiz.pdfas.api.ws.PDFASVerifyResult;
+import at.gv.egiz.pdfas.api.ws.VerificationLevel;
+import at.gv.egiz.pdfas.web.client.RemotePDFSigner;
+import at.gv.egiz.pdfas.web.client.RemotePDFVerifier;
+
+public class SimpleTest1 {
+
+ public static void main(String[] args) {
+ try {
+ String file = "/Users/amarsalek/Documents/pdf-as-4/unsigned.pdf";
+ FileInputStream fis = new FileInputStream(file);
+ byte[] inputData = IOUtils.toByteArray(fis);
+
+ PDFASSignParameters signParameters = new PDFASSignParameters();
+// signParameters.setConnector(Connector.JKS);
+ signParameters.setConnector(Connector.BKU);
+ signParameters.setPosition(null);
+ signParameters.setProfile("SIGNATURBLOCK_SMALL_DE1");
+ signParameters.setQRCodeContent("TEST CONTENT");
+ //signParameters.setKeyIdentifier("test");
+
+ PDFASSignRequest request = new PDFASSignRequest();
+ request.setInputData(inputData);
+ request.setParameters(signParameters);
+ request.setRequestID("SOME TEST ID");
+ request.getSignatureBlockParameters().put("abc","SOAP Test");
+ //URL endpoint = new
+ //URL("http://demo.egiz.gv.at/demoportal-pdf_as/wssign?wsdl");
+ //URL endpoint = new
+ // URL("http://www.buergerkarte.at/pdf-as-extern-4/wssign?wsdl");
+// String baseUrl = "http://demo.egiz.gv.at/demoportal-pdf_as/services/";
+ String baseUrl = "http://localhost:8080/pdf-as-web/services/";
+ //URL endpoint = new URL(
+ // "http://192.168.56.10/pdf-as-web/wssign?wsdl");
+
+ URL signEndpoint = new URL(baseUrl + "wssign?wsdl");
+ URL verifyEndpoint = new URL(baseUrl + "wsverify?wsdl");
+
+ RemotePDFSigner signer = new RemotePDFSigner(signEndpoint, true);
+// RemotePDFVerifier verifier = new RemotePDFVerifier(verifyEndpoint, true);
+
+ PDFASSignRequest signrequest = new PDFASSignRequest();
+ signrequest.setInputData(inputData);
+ signrequest.setParameters(signParameters);
+ signParameters.setTransactionId("MYID ....");
+ signrequest.getSignatureBlockParameters().put("abc","SOAP Test 5555");
+ System.out.println("Simple Request:");
+ PDFASSignResponse response = signer.signPDFDokument(signrequest);
+
+ System.out.println("Sign Error: " + response.getError());
+ System.out.println("redirect url: " + response.getRedirectUrl());
+ File outputFile = new File(file+"_signedSOAP.pdf");
+ try (FileOutputStream outputStream = new FileOutputStream(outputFile)) {
+ outputStream.write(response.getSignedPDF());
+ }
+
+ PDFASVerifyRequest verifyRequest = new PDFASVerifyRequest();
+ verifyRequest.setInputData(response.getSignedPDF());
+ verifyRequest.setVerificationLevel(VerificationLevel.INTEGRITY_ONLY);
+
+// PDFASVerifyResponse verifyResponse = verifier.verifyPDFDokument(verifyRequest);
+
+// List<PDFASVerifyResult> results = verifyResponse.getVerifyResults();
+//
+// for(int i = 0; i < results.size(); i++) {
+// PDFASVerifyResult result = results.get(i);
+// printVerifyResult(result);
+// }
+
+ /*
+ * System.out.println("Simple Request:"); byte[] outputFile =
+ * signer.signPDFDokument(inputData, signParameters);
+ *
+ * FileOutputStream fos = new FileOutputStream(
+ * "/home/afitzek/simple_request_signed.pdf");
+ * fos.write(outputFile); fos.close();
+ *
+ * System.out.println("Simple Request Obj:"); PDFASSignResponse
+ * response = signer.signPDFDokument(request);
+ *
+ * if (response.getSignedPDF() != null) { FileOutputStream fos2 =
+ * new FileOutputStream(
+ * "/home/afitzek/simple_request_obj_signed.pdf");
+ * fos2.write(response.getSignedPDF()); fos2.close(); }
+ *
+ * if(response.getError() != null) { System.out.println("ERROR: " +
+ * response.getError()); }
+ */
+
+ /*
+ List<PDFASSignRequest> bulk = new ArrayList<PDFASSignRequest>();
+ for (int i = 0; i < 10; i++) {
+ bulk.add(request);
+ }
+
+ PDFASBulkSignRequest bulkRequest = new PDFASBulkSignRequest();
+ bulkRequest.setSignRequests(bulk);
+
+ for (int j = 0; j < 10; j++) {
+ System.out.println("Bulk Request:");
+ PDFASBulkSignResponse responses = signer
+ .signPDFDokument(bulkRequest);
+
+ for (int i = 0; i < responses.getSignResponses().size(); i++) {
+ PDFASSignResponse bulkresponse = responses
+ .getSignResponses().get(i);
+ System.out.println("ID: " + bulkresponse.getRequestID());
+
+ if (bulkresponse.getError() != null) {
+ System.out.println("ERROR: " + bulkresponse.getError());
+ } else {
+ System.out.println("OK");
+ }
+ }
+ }
+ */
+ System.out.println("Done!");
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void printVerifyResult(PDFASVerifyResult result) {
+ System.out.println(result.getSignatureIndex());
+ System.out.println(" Certificate: " + result.getCertificate());
+ System.out.println(" Cert Messag: " + result.getCertificateMessage());
+ System.out.println(" Cert Code : " + result.getCertificateCode());
+ System.out.println(" Value Code : " + result.getValueCode());
+ System.out.println(" Value Messg: " + result.getValueMessage());
+ System.out.println(" SignedBy : " + result.getSignedBy());
+ System.out.println(" Processed : " + result.getProcessed());
+ System.out.println(" Signed Data: " + result.getSignedData());
+ }
+
+}
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
index 11ee4790..0e08de59 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
@@ -364,11 +364,13 @@ public class PdfAsHelper {
* The Web response
* @param pdfData
* The pdf data
+ * @param dynamicSignatureBlockArguments
* @return The signed pdf data
* @throws Exception
*/
- public static byte[] synchornousSignature(HttpServletRequest request,
- HttpServletResponse response, byte[] pdfData) throws Exception {
+ public static byte[] synchronousSignature(HttpServletRequest request,
+ HttpServletResponse response, byte[] pdfData,
+ Map<String, String> dynamicSignatureBlockArguments) throws Exception {
validatePdfSize(request, response, pdfData);
Configuration config = pdfAs.getConfiguration();
@@ -506,6 +508,8 @@ public class PdfAsHelper {
// set Signature Position
signParameter.setSignaturePosition(buildPosString(request, response));
+ //set signature block parameters
+ signParameter.getDynamicSignatureBlockArguments().putAll(dynamicSignatureBlockArguments);
@SuppressWarnings("unused")
SignResult result = pdfAs.sign(signParameter);
@@ -522,8 +526,8 @@ public class PdfAsHelper {
* @return The signed pdf data
* @throws Exception
*/
- public static PDFASSignResponse synchornousServerSignature(byte[] pdfData,
- PDFASSignParameters params) throws Exception {
+ public static PDFASSignResponse synchronousServerSignature(byte[] pdfData,
+ PDFASSignParameters params, Map<String, String> dynamicSignatureBlockArguments) throws Exception {
Configuration config = pdfAs.getConfiguration();
if (WebConfiguration.isAllowExtOverwrite() && params.getOverrides() != null) {
@@ -658,6 +662,8 @@ public class PdfAsHelper {
signParameter.setPreprocessorArguments(params.getPreprocessor()
.getMap());
}
+ //TODO alex
+ signParameter.getDynamicSignatureBlockArguments().putAll(dynamicSignatureBlockArguments);
SignResult signResult = pdfAs.sign(signParameter);
@@ -771,7 +777,7 @@ public class PdfAsHelper {
HttpServletResponse response, ServletContext context,
byte[] pdfData, String connector, String position,
String transactionId, String profile,
- Map<String, String> preProcessor, Map<String, String> overwrite) throws Exception {
+ Map<String, String> preProcessor, Map<String, String> overwrite, Map<String, String> dynamicSignatureBlockArguments) throws Exception {
// TODO: Protect session so that only one PDF can be signed during one
// session
@@ -856,6 +862,7 @@ public class PdfAsHelper {
// set Signature Position
signParameter.setSignaturePosition(position);
+ signParameter.setDynamicSignatureBlockArguments(dynamicSignatureBlockArguments);
StatusRequest statusRequest = pdfAs.startSign(signParameter);
session.setAttribute(PDF_STATUS, statusRequest);
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
index 2c2af9a9..841b8428 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java
@@ -27,7 +27,6 @@ import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.common.exceptions.PdfAsException;
import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsValidationException;
import at.gv.egiz.pdfas.common.settings.ISettings;
-import at.gv.egiz.pdfas.common.utils.StringUtils;
import at.gv.egiz.pdfas.lib.api.IConfigurationConstants;
import at.gv.egiz.pdfas.lib.api.PdfAsFactory;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel;
@@ -57,6 +56,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
+import java.util.Map;
/**
* Servlet implementation class Sign
@@ -366,7 +366,11 @@ public class ExternSignServlet extends HttpServlet {
PdfAsHelper.setSignatureDataHash(request, pdfDataHash);
logger.debug("Storing signatures data hash: " + pdfDataHash);
-
+
+ //TODO alex parse??
+ Map<String, String> dynamicSignatureBlockArguments = null;
+
+
logger.debug("Starting signature creation with: " + connector);
//IPlainSigner signer;
@@ -396,11 +400,12 @@ public class ExternSignServlet extends HttpServlet {
}
PdfAsHelper.setStatisticEvent(request, response, statisticEvent);
-
- PdfAsHelper.startSignature(request, response, getServletContext(), pdfData, connector,
+
+
+ PdfAsHelper.startSignature(request, response, getServletContext(), pdfData, connector,
PdfAsHelper.buildPosString(request, response), transactionId, PdfAsParameterExtractor
.getSigType(request), PdfAsParameterExtractor.getPreProcessorMap(request),
- PdfAsParameterExtractor.getOverwriteMap(request));
+ PdfAsParameterExtractor.getOverwriteMap(request), dynamicSignatureBlockArguments);
return;
} else if (connector.equals("jks") || connector.equals("moa")) {
// start synchronous siganture creation
@@ -432,8 +437,8 @@ public class ExternSignServlet extends HttpServlet {
}
}
- byte[] pdfSignedData = PdfAsHelper.synchornousSignature(request,
- response, pdfData);
+ byte[] pdfSignedData = PdfAsHelper.synchronousSignature(request,
+ response, pdfData, dynamicSignatureBlockArguments);
PdfAsHelper.setSignedPdf(request, response, pdfSignedData);
statisticEvent.setStatus(Status.OK);
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java
index 13d874e8..4925ec65 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/JSONAPIServlet.java
@@ -1,9 +1,7 @@
package at.gv.egiz.pdfas.web.servlets;
import at.gv.egiz.pdfas.api.ws.PDFASSignParameters;
-import at.gv.egiz.pdfas.api.ws.PDFASSignRequest;
import at.gv.egiz.pdfas.api.ws.PDFASSignResponse;
-import at.gv.egiz.pdfas.api.ws.VerificationLevel;
import at.gv.egiz.pdfas.common.exceptions.PDFASError;
import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter;
import at.gv.egiz.pdfas.lib.api.verify.VerifyResult;
@@ -15,10 +13,8 @@ import at.gv.egiz.pdfas.web.helper.JSONStartResponse;
import at.gv.egiz.pdfas.web.helper.PdfAsHelper;
import at.gv.egiz.pdfas.web.stats.StatisticEvent;
import at.gv.egiz.pdfas.web.stats.StatisticFrontend;
-import at.gv.egiz.pdfas.web.store.RequestStore;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
-import org.json.HTTP;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -27,8 +23,6 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.xml.ws.WebServiceException;
-import java.io.BufferedReader;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@@ -139,11 +133,15 @@ public class JSONAPIServlet extends HttpServlet {
parameters.setPosition(position);
parameters.setProfile(profile);
+ //TODO alex fill here
+ Map<String, String> dynamicSignatureBlockArguments = null;
+
if (PDFASSignParameters.Connector.MOA.equals(connectorEnum)
|| PDFASSignParameters.Connector.JKS.equals(connectorEnum)) {
// Plain server based signatures!!
- PDFASSignResponse pdfasSignResponse = PdfAsHelper.synchornousServerSignature(
- inputDocument, parameters);
+
+ PDFASSignResponse pdfasSignResponse = PdfAsHelper.synchronousServerSignature(
+ inputDocument, parameters, dynamicSignatureBlockArguments);
VerifyResult verifyResult = null;
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
index 73f8299c..664dd9b3 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java
@@ -174,13 +174,15 @@ public class UIEntryPointServlet extends HttpServlet {
overwrite = pdfAsRequest.getParameters().getOverrides()
.getMap();
}
+ //TODO alex
+ Map<String, String> dynamicSignatureBlockArguments = pdfAsRequest.getSignatureBlockParameters();
PdfAsHelper.startSignature(req, resp, getServletContext(),
pdfAsRequest.getInputData(), connector.toString(),
pdfAsRequest.getParameters().getPosition(),
pdfAsRequest.getParameters().getTransactionId(),
pdfAsRequest.getParameters().getProfile(), map,
- overwrite);
+ overwrite, dynamicSignatureBlockArguments);
} else {
throw new PdfAsWebException("Invalid connector ("
+ Connector.BKU + " | " + Connector.ONLINEBKU + " | "
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java
index f850c5ae..ccbaf4fb 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/ws/PDFASSigningImpl.java
@@ -104,8 +104,8 @@ public class PDFASSigningImpl implements PDFASSigning {
|| request.getParameters().getConnector()
.equals(Connector.JKS)) {
// Plain server based signatures!!
- response = PdfAsHelper.synchornousServerSignature(
- request.getInputData(), request.getParameters());
+ response = PdfAsHelper.synchronousServerSignature(
+ request.getInputData(), request.getParameters(), request.getSignatureBlockParameters());
VerifyResult verifyResult = null;
if (request.getVerificationLevel() != null &&