From 0773cfcf2370b84e2ceba468d6e4ae001463b711 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 3 Mar 2016 12:51:52 +0100 Subject: pdfData null check --- .../java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pdf-as-web/src/main') 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 a462480e..b70539a4 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 @@ -287,6 +287,10 @@ public class ExternSignServlet extends HttpServlet { protected void doSignature(HttpServletRequest request, HttpServletResponse response, byte[] pdfData, StatisticEvent statisticEvent) throws Exception { + if(pdfData == null) { + throw new PdfAsException("No Signature data available"); + } + if(pdfData[0] != 0x25 || pdfData[1] != 0x50 || pdfData[2] != 0x44 || pdfData[3] != 0x46) { throw new PdfAsWebException( "Received data is not a valid PDF-Document"); @@ -325,10 +329,6 @@ public class ExternSignServlet extends HttpServlet { PdfAsHelper.setPDFFileName(request, filename); } - if(pdfData == null) { - throw new PdfAsException("No Signature data available"); - } - String pdfDataHash = DigestHelper.getHexEncodedHash(pdfData); PdfAsHelper.setSignatureDataHash(request, pdfDataHash); -- cgit v1.2.3