diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-07-15 09:53:36 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-07-15 09:53:36 +0200 |
commit | 8eecd5504d82b4827dda5b0549e0662051f37df2 (patch) | |
tree | d1cde5bede36b68f3b3c65b180c040da4d4801d1 /pdf-as-web | |
parent | 52123b59a26051ef01c0e33e5f55faa7e232f65a (diff) | |
download | pdf-as-4-8eecd5504d82b4827dda5b0549e0662051f37df2.tar.gz pdf-as-4-8eecd5504d82b4827dda5b0549e0662051f37df2.tar.bz2 pdf-as-4-8eecd5504d82b4827dda5b0549e0662051f37df2.zip |
Verification Level for verification after signature
Diffstat (limited to 'pdf-as-web')
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java | 19 | ||||
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java | 4 |
2 files changed, 23 insertions, 0 deletions
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); |