diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-07-11 13:38:49 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-07-11 13:38:49 +0200 |
commit | 1219abaf9f0029e39f5fbdf342fd4ebf07144b5b (patch) | |
tree | 1baeb54030e016158ea287a9c87d70597e0f19f5 /pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets | |
parent | 0bfafff409078ef49b2d4a0d71405e8f5b0eb078 (diff) | |
download | pdf-as-4-1219abaf9f0029e39f5fbdf342fd4ebf07144b5b.tar.gz pdf-as-4-1219abaf9f0029e39f5fbdf342fd4ebf07144b5b.tar.bz2 pdf-as-4-1219abaf9f0029e39f5fbdf342fd4ebf07144b5b.zip |
added Signature Verification Level
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets')
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java | 11 | ||||
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java | 15 |
2 files changed, 26 insertions, 0 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java index 745e5ca8..cef19a76 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/PDFData.java @@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.gv.egiz.pdfas.api.ws.PDFASVerificationResponse; import at.gv.egiz.pdfas.web.helper.PdfAsHelper; /** @@ -94,6 +95,16 @@ public class PDFData extends HttpServlet { } } response.setHeader("Content-Disposition", "inline;filename=" + PdfAsHelper.getPDFFileName(request)); + String pdfCert = PdfAsHelper.getSignerCertificate(request); + if(pdfCert != null) { + response.setHeader("Signer-Certificate", pdfCert); + } + + PDFASVerificationResponse resp = PdfAsHelper.getPDFASVerificationResponse(request); + if(resp != null) { + response.setHeader("CertificateCheckCode", String.valueOf(resp.getCertificateCode())); + response.setHeader("ValueCheckCode", String.valueOf(resp.getValueCode())); + } response.setContentType("application/pdf"); OutputStream os = response.getOutputStream(); os.write(signedData); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java index 8eacd3cd..3ff6eb09 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/UIEntryPointServlet.java @@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory; import at.gv.egiz.pdfas.api.ws.PDFASSignRequest; import at.gv.egiz.pdfas.api.ws.PDFASSignParameters.Connector; 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.PdfAsStoreException; import at.gv.egiz.pdfas.web.exception.PdfAsWebException; @@ -92,6 +93,19 @@ public class UIEntryPointServlet extends HttpServlet { String errorUrl = pdfAsRequest.getParameters().getInvokeErrorURL(); PdfAsHelper.setErrorURL(req, resp, errorUrl); + SignatureVerificationLevel lvl = SignatureVerificationLevel.INTEGRITY_ONLY_VERIFICATION; + if(pdfAsRequest.getVerificationLevel() != null) { + switch (pdfAsRequest.getVerificationLevel()) { + case INTEGRITY_ONLY: + lvl = SignatureVerificationLevel.INTEGRITY_ONLY_VERIFICATION; + break; + default: + lvl = SignatureVerificationLevel.FULL_VERIFICATION; + break; + } + } + PdfAsHelper.setVerificationLevel(req, lvl); + if(pdfAsRequest.getInputData() == null) { throw new PdfAsException("No Signature data available"); } @@ -135,6 +149,7 @@ public class UIEntryPointServlet extends HttpServlet { } catch (Throwable e) { + logger.error("Failed to process Request: ", e); PdfAsHelper.setSessionException(req, resp, e.getMessage(), e); PdfAsHelper.gotoError(getServletContext(), req, resp); } |