aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
diff options
context:
space:
mode:
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.java28
1 files changed, 18 insertions, 10 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 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<VerifyResult> synchornousVerify(
+ public static List<VerifyResult> 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<VerifyResult> synchornousVerify(byte[] pdfData,
- int signIdx, SignatureVerificationLevel lvl,
- Map<String, String> preProcessor) throws Exception {
+ public static List<VerifyResult> synchronousVerify(byte[] pdfData,
+ int signIdx, SignatureVerificationLevel lvl,
+ Map<String, String> 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<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.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<String, String> 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<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 +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<VerifyResult> verResults = PdfAsHelper.synchornousVerify(
+ List<VerifyResult> verResults = PdfAsHelper.synchronousVerify(
baos.toByteArray(), -2,
PdfAsHelper.getVerificationLevel(request), null);