From 8eecd5504d82b4827dda5b0549e0662051f37df2 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 15 Jul 2014 09:53:36 +0200 Subject: Verification Level for verification after signature --- .../pdfas/web/helper/PdfAsParameterExtractor.java | 19 +++++++++++++++++++ .../gv/egiz/pdfas/web/servlets/ExternSignServlet.java | 4 ++++ 2 files changed, 23 insertions(+) (limited to 'pdf-as-web/src/main') diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java index c2cee9c6..23335268 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java @@ -25,6 +25,8 @@ package at.gv.egiz.pdfas.web.helper; import javax.servlet.http.HttpServletRequest; +import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel; + public class PdfAsParameterExtractor { public static final String PARAM_CONNECTOR = "connector"; @@ -35,6 +37,11 @@ public class PdfAsParameterExtractor { public static final String PARAM_INVOKE_URL = "invoke-app-url"; public static final String PARAM_INVOKE_URL_TARGET = "invoke-app-url-target"; public static final String PARAM_INVOKE_URL_ERROR = "invoke-app-error-url"; + + public static final String PARAM_VERIFY_LEVEL = "verify-level"; + public static final String PARAM_VERIFY_LEVEL_OPTION_FULL = "full"; + public static final String PARAM_VERIFY_LEVEL_OPTION_INT_ONLY = "intOnly"; + public static final String PARAM_LOCALE = "locale"; public static final String PARAM_NUM_BYTES = "num-bytes"; public static final String PARAM_PDF_URL = "pdf-url"; @@ -65,6 +72,18 @@ public class PdfAsParameterExtractor { return (String)request.getAttribute(PARAM_INVOKE_URL); } + public static SignatureVerificationLevel getVerificationLevel(HttpServletRequest request) { + String value = (String)request.getAttribute(PARAM_VERIFY_LEVEL); + if(value != null) { + if(value.equals(PARAM_VERIFY_LEVEL_OPTION_FULL)) { + return SignatureVerificationLevel.FULL_VERIFICATION; + } else if(value.equals(PARAM_VERIFY_LEVEL_OPTION_INT_ONLY)) { + return SignatureVerificationLevel.INTEGRITY_ONLY_VERIFICATION; + } + } + return SignatureVerificationLevel.INTEGRITY_ONLY_VERIFICATION; + } + public static String getInvokeTarget(HttpServletRequest request) { return (String)request.getAttribute(PARAM_INVOKE_URL_TARGET); } 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 fb633bd5..39078529 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 @@ -39,6 +39,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; +import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter.SignatureVerificationLevel; import at.gv.egiz.pdfas.web.config.WebConfiguration; import at.gv.egiz.pdfas.web.exception.PdfAsWebException; import at.gv.egiz.pdfas.web.helper.DigestHelper; @@ -247,6 +248,9 @@ public class ExternSignServlet extends HttpServlet { String invokeUrl = PdfAsParameterExtractor.getInvokeURL(request); PdfAsHelper.setInvokeURL(request, response, invokeUrl); + SignatureVerificationLevel lvl = PdfAsParameterExtractor.getVerificationLevel(request); + PdfAsHelper.setVerificationLevel(request, lvl); + String invokeTarget = PdfAsParameterExtractor.getInvokeTarget(request); PdfAsHelper.setInvokeTarget(request, response, invokeTarget); -- cgit v1.2.3