From 8ed8e4e931c1cb3d3c814a53a07f73b566c3b719 Mon Sep 17 00:00:00 2001 From: Alexander Marsalek Date: Fri, 2 Jul 2021 14:06:44 +0200 Subject: v4.2.0 --- .../at/gv/egiz/pdfas/web/helper/PdfAsHelper.java | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java') 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..2f7c9323 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 @@ -301,7 +301,7 @@ public class PdfAsHelper { return sb.toString(); } - public static List synchornousVerify( + public static List synchronousVerify( HttpServletRequest request, HttpServletResponse response, byte[] pdfData) throws Exception { String signidxString = PdfAsParameterExtractor.getSigIdx(request); @@ -332,9 +332,9 @@ public class PdfAsHelper { return results; } - public static List synchornousVerify(byte[] pdfData, - int signIdx, SignatureVerificationLevel lvl, - Map preProcessor) throws Exception { + public static List synchronousVerify(byte[] pdfData, + int signIdx, SignatureVerificationLevel lvl, + Map preProcessor) throws Exception { logger.debug("Verifing Signature index: " + signIdx); Configuration config = pdfAs.getConfiguration(); @@ -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 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.setDynamicSignatureBlockArguments(dynamicSignatureBlockArguments); @SuppressWarnings("unused") SignResult result = pdfAs.sign(signParameter); @@ -522,8 +526,9 @@ 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 dynamicSignatureBlockArguments) throws Exception { + Configuration config = pdfAs.getConfiguration(); if (WebConfiguration.isAllowExtOverwrite() && params.getOverrides() != null) { @@ -658,6 +663,8 @@ public class PdfAsHelper { signParameter.setPreprocessorArguments(params.getPreprocessor() .getMap()); } + //TODO alex + signParameter.setDynamicSignatureBlockArguments(dynamicSignatureBlockArguments); SignResult signResult = pdfAs.sign(signParameter); @@ -771,7 +778,7 @@ public class PdfAsHelper { HttpServletResponse response, ServletContext context, byte[] pdfData, String connector, String position, String transactionId, String profile, - Map preProcessor, Map overwrite) throws Exception { + Map preProcessor, Map overwrite, Map dynamicSignatureBlockArguments) throws Exception { // TODO: Protect session so that only one PDF can be signed during one // session @@ -856,6 +863,7 @@ public class PdfAsHelper { // set Signature Position signParameter.setSignaturePosition(position); + signParameter.setDynamicSignatureBlockArguments(dynamicSignatureBlockArguments); StatusRequest statusRequest = pdfAs.startSign(signParameter); session.setAttribute(PDF_STATUS, statusRequest); @@ -1283,7 +1291,7 @@ public class PdfAsHelper { baos.close(); PDFASVerificationResponse verResponse = new PDFASVerificationResponse(); - List verResults = PdfAsHelper.synchornousVerify( + List verResults = PdfAsHelper.synchronousVerify( baos.toByteArray(), -2, PdfAsHelper.getVerificationLevel(request), null); -- cgit v1.2.3