aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-16 09:43:49 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-16 09:43:49 +0200
commit3c4eac027bfd68bfce63a2eed010ccc2b7310802 (patch)
tree507f8586045b57e4457da23ce7aedca6a497a913 /pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
parent00894355450179bea4b56e0abcf16243964ff286 (diff)
downloadpdf-as-4-3c4eac027bfd68bfce63a2eed010ccc2b7310802.tar.gz
pdf-as-4-3c4eac027bfd68bfce63a2eed010ccc2b7310802.tar.bz2
pdf-as-4-3c4eac027bfd68bfce63a2eed010ccc2b7310802.zip
PreProcessor Interface added and API rebuild
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java15
1 files changed, 11 insertions, 4 deletions
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 3323a252..fc499f94 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
@@ -35,6 +35,7 @@ import java.net.URLEncoder;
import java.security.cert.CertificateException;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import javax.imageio.ImageIO;
import javax.servlet.RequestDispatcher;
@@ -298,7 +299,7 @@ public class PdfAsHelper {
}
public static List<VerifyResult> synchornousVerify(byte[] pdfData,
- int signIdx, SignatureVerificationLevel lvl) throws Exception {
+ int signIdx, SignatureVerificationLevel lvl, Map<String, String> preProcessor) throws Exception {
logger.debug("Verifing Signature index: " + signIdx);
Configuration config = pdfAs.getConfiguration();
@@ -308,6 +309,7 @@ public class PdfAsHelper {
VerifyParameter verifyParameter = PdfAsFactory.createVerifyParameter(
config, dataSource);
+ verifyParameter.setPreprocessorArguments(preProcessor);
verifyParameter.setSignatureVerificationLevel(lvl);
verifyParameter.setDataSource(dataSource);
verifyParameter.setConfiguration(config);
@@ -425,6 +427,11 @@ public class PdfAsHelper {
// set Signature Position
signParameter.setSignaturePosition(params.getPosition());
+ // Set Preprocessor
+ if(params.getPreprocessor() != null) {
+ signParameter.setPreprocessorArguments(params.getPreprocessor().getMap());
+ }
+
SignResult signResult = pdfAs.sign(signParameter);
PDFASSignResponse signResponse = new PDFASSignResponse();
@@ -444,7 +451,7 @@ public class PdfAsHelper {
public static void startSignature(HttpServletRequest request,
HttpServletResponse response, ServletContext context,
byte[] pdfData, String connector, String position,
- String transactionId, String profile) throws Exception {
+ String transactionId, String profile, Map<String, String> preProcessor) throws Exception {
// TODO: Protect session so that only one PDF can be signed during one
// session
@@ -483,7 +490,7 @@ public class PdfAsHelper {
throw new PdfAsWebException(
"Invalid connector (bku | onlinebku | mobilebku | moa | jks)");
}
-
+ signParameter.setPreprocessorArguments(preProcessor);
signParameter.setPlainSigner(signer);
session.setAttribute(PDF_SIGNER, signer);
session.setAttribute(PDF_SL_INTERACTIVE, connector);
@@ -677,7 +684,7 @@ public class PdfAsHelper {
PDFASVerificationResponse verResponse = new PDFASVerificationResponse();
List<VerifyResult> verResults = PdfAsHelper.synchornousVerify(
signedPdf, -2,
- PdfAsHelper.getVerificationLevel(request));
+ PdfAsHelper.getVerificationLevel(request), null);
if (verResults.size() != 1) {
throw new WebServiceException(