From 11b5950be66bcc9d6f0bb28d3fc9d211bc70f4d9 Mon Sep 17 00:00:00 2001 From: tknall Date: Tue, 16 Mar 2010 12:07:29 +0000 Subject: Catching OutOfMemory exceptions, returning appropriate error message/code Binary signature: bug concerning indirect pdf objects fixed SignaturePositioning improved (Signature position can be declared by String which is parsed) Some more error codes (Out of memory, Invalid signature position) iText utility for creation of pdf files added ConfigUtils updated (destination of configuration to be extracted can now be chosen) PDFASUtils updated (more tools) WebApplication: Freetext pdf creation implemented WebApplication: XSS security updates git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@580 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- src/main/webapp/WEB-INF/decorators.xml | 5 -- src/main/webapp/WEB-INF/web.xml | 10 +++- src/main/webapp/css/pdfas-styles.css | 7 +++ src/main/webapp/jsp/SIGNATURBLOCK.jsp | 15 ++---- src/main/webapp/jsp/error.jsp | 7 +-- src/main/webapp/jsp/signupload.jsp | 90 +++++++++++++++++++++++++++++----- 6 files changed, 103 insertions(+), 31 deletions(-) (limited to 'src/main/webapp') diff --git a/src/main/webapp/WEB-INF/decorators.xml b/src/main/webapp/WEB-INF/decorators.xml index 352a902..a88892d 100644 --- a/src/main/webapp/WEB-INF/decorators.xml +++ b/src/main/webapp/WEB-INF/decorators.xml @@ -9,11 +9,6 @@ /*.pdf - /* diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index ce82e9a..4a7ad77 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -39,7 +39,15 @@ forceRequestEncoding - false + true + + + setResponseEncoding + true + + + forceResponseEncoding + true diff --git a/src/main/webapp/css/pdfas-styles.css b/src/main/webapp/css/pdfas-styles.css index a7e1906..6831232 100644 --- a/src/main/webapp/css/pdfas-styles.css +++ b/src/main/webapp/css/pdfas-styles.css @@ -16,6 +16,13 @@ table.pdfassignature td.pdfaslabel { /* word-spacing: nowrap; */ } +textarea.freetext { + width: 450px; + height: 150px; + font: 1em 'Courier New', courier, monospace; + margin: 0px 0px 0px 0px; +} + table#pdfasupperformtable { margin-top: 10px; } diff --git a/src/main/webapp/jsp/SIGNATURBLOCK.jsp b/src/main/webapp/jsp/SIGNATURBLOCK.jsp index 336365b..66e64e3 100644 --- a/src/main/webapp/jsp/SIGNATURBLOCK.jsp +++ b/src/main/webapp/jsp/SIGNATURBLOCK.jsp @@ -26,7 +26,7 @@ if ("SIGNATURBLOCK_DE".equals(type)) { sbValue = "Signaturwert"; sbLabel = "signatur-logo_de-100.png"; - sbMetaValue = "Informationen zur Prüfung der elektronischen Signatur und des Ausdrucks finden Sie unter: "; + sbMetaValue = "Informationen zur Prüfung der elektronischen Signatur und des Ausdrucks finden Sie unter: "; sbName = "Unterzeichner"; sbDate = "Datum/Zeit-UTC"; sbIssuer = "Aussteller-Zertifikat"; @@ -37,7 +37,7 @@ } else { sbValue = "Signature Value"; sbLabel = "signatur-logo_en-100.png"; - sbMetaValue = "Information about the verification of the electronic signature and of the printout can be found at: "; + sbMetaValue = "Information about the verification of the electronic signature and of the printout can be found at: "; sbName = "Signatory"; sbDate = "Date/Time-UTC"; sbIssuer = "Issuer-Certificate"; @@ -92,15 +92,8 @@ <%= sbID %> - <% if (Constants.SIGNATURE_DEVICE_MOC.equals(device)) { %> -
etsi-moc-1.0@12345678
- <% } else { %> -
etsi-bka-1.0@1234567890-123456789@
-
12345-1234-
-
0-
-
12345-
-
12345
- <% } // end if %> +
etsi-moc-1.1@dbc17c36
+ <%= sbMeta %> diff --git a/src/main/webapp/jsp/error.jsp b/src/main/webapp/jsp/error.jsp index d135f88..8a06691 100644 --- a/src/main/webapp/jsp/error.jsp +++ b/src/main/webapp/jsp/error.jsp @@ -8,6 +8,7 @@ <%@ page import="org.apache.commons.httpclient.util.EncodingUtil" %> <%@ page import="org.apache.commons.httpclient.NameValuePair" %> <%@ page import="at.gv.egiz.pdfas.web.helper.SignServletHelper" %> +<%@ page import="org.apache.commons.lang.StringEscapeUtils" %> <%@ page import="java.io.*" %> <%@ include file="language.jsp" %> @@ -80,12 +81,12 @@
<% if (rb) { %> - <% } else { out.write(error); } %> + <% } else { out.write(StringEscapeUtils.escapeHtml(error)); } %>
: <% if (rb) { %> - <% } else { out.write(cause); } %> + <% } else { out.write(StringEscapeUtils.escapeHtml(cause)); } %>
<% if (!isExternalInvocation && !paramInvok) { %>
@@ -99,7 +100,7 @@ pe.printStackTrace(pw); sw.close(); pw.close(); - out.print(sw); + out.print(StringEscapeUtils.escapeHtml(sw.toString())); } %> diff --git a/src/main/webapp/jsp/signupload.jsp b/src/main/webapp/jsp/signupload.jsp index 010012b..f6c02fe 100644 --- a/src/main/webapp/jsp/signupload.jsp +++ b/src/main/webapp/jsp/signupload.jsp @@ -1,5 +1,6 @@ <%@ page import="at.knowcenter.wag.egov.egiz.web.FormFields" %> <%@ page import="at.knowcenter.wag.egov.egiz.web.SessionAttributes" %> +<%@ page import="org.apache.commons.lang.StringEscapeUtils" %> <%@ page import="at.gv.egiz.pdfas.api.commons.Constants" %> <%@ page import="at.gv.egiz.pdfas.web.i18n.LanguageDecoratorMapper"%> <%@ page import="at.knowcenter.wag.egov.egiz.web.servlets.UpdateFormServlet"%> @@ -41,18 +42,35 @@ updateform.<%= FormFields.FIELD_MODE %>.value = submitform.<%= FormFields.FIELD_MODE %>.value; updateform.<%= FormFields.FIELD_CONNECTOR %>.value = submitform.<%= FormFields.FIELD_CONNECTOR %>.value; updateform.<%= FormFields.FIELD_PDFA_ENABLED %>.value = (submitform.<%= FormFields.FIELD_PDFA_ENABLED %>.checked == true); + updateform.<%= FormFields.FIELD_SOURCE %>.value = submitform.<%= FormFields.FIELD_SOURCE %>.value; + if (submitform.<%= FormFields.FIELD_FREETEXT %>) { + updateform.<%= FormFields.FIELD_FREETEXT %>.value = submitform.<%= FormFields.FIELD_FREETEXT %>.value; + } updateform.submit(); return(false); } function submitForm(preview) { var submitform = document.getElementById('submitform'); - if (!submitform.fileupload.value) { - if (preview) { - alert(''); - } else { - alert(''); + if (submitform.fileupload) { + // file + if (!submitform.fileupload.value) { + if (preview) { + alert(''); + } else { + alert(''); + } + return(false); + } + } else { + // freetext + if (!submitform.freetext.value) { + if (preview) { + alert(''); + } else { + alert(''); + } + return(false); } - return(false); } if (preview) { submitform.<%= FormFields.FIELD_PREVIEW %>.value='true'; @@ -118,6 +136,21 @@ } } session.setAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_TYPE_KEY, type); + + // source + String source = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_SOURCE_KEY); + if (source == null) { + source = FormFields.VALUE_SOURCE_FILE; + } + session.setAttribute(UpdateFormServlet.UPLOADFORM_SOURCE_KEY, source); + boolean freeText = FormFields.VALUE_SOURCE_FREETEXT.equals(source); + + // freetext + String freeTextValue = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_FREETEXT_KEY); + if (freeTextValue == null) { + freeTextValue = ""; + } + session.setAttribute(UpdateFormServlet.UPLOADFORM_FREETEXT_KEY, freeTextValue); %> @@ -131,13 +164,29 @@ <% } // end if %> -

-
-
+

+ <% if (freeText) { %> + + <% } else { %> + + <% } %> +

+
+ <% if (freeText) { %> + + <% } else { %> + + <% } %> +
+ - + + + <% if (freeText) { %> + + <% } // end if %>
+ + + + + + + <% if (freeText) { %> + + <% } else { %> + + <% } // end if freetext %> + + -
: <% if (pdfa) { %><% } %>
+
+ : <% if (!freeText) { %><% } %> <% if (pdfa) { %><% } %> +
-- cgit v1.2.3