aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-03-03 12:51:52 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-03-03 12:51:52 +0100
commit0773cfcf2370b84e2ceba468d6e4ae001463b711 (patch)
tree28fb14faef1c8db19ab941d9121c3cb1a7fa528e /pdf-as-web/src/main/java/at/gv/egiz
parent2cfb25728fe4a73680f3abf624fb723d8b74e5b2 (diff)
downloadpdf-as-4-0773cfcf2370b84e2ceba468d6e4ae001463b711.tar.gz
pdf-as-4-0773cfcf2370b84e2ceba468d6e4ae001463b711.tar.bz2
pdf-as-4-0773cfcf2370b84e2ceba468d6e4ae001463b711.zip
pdfData null check
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java8
1 files changed, 4 insertions, 4 deletions
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);