diff options
author | tknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2008-07-15 16:02:02 +0000 |
---|---|---|
committer | tknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2008-07-15 16:02:02 +0000 |
commit | 1318c462d46bb248e0587666c04944cfe2c83db6 (patch) | |
tree | 80bee4514512e07435cc38b1fd21d6c1cb787cc3 /src/main/java/at/knowcenter | |
parent | aefaae42dfaed8fd79feb232547d357ab07baecd (diff) | |
download | pdf-as-3-1318c462d46bb248e0587666c04944cfe2c83db6.tar.gz pdf-as-3-1318c462d46bb248e0587666c04944cfe2c83db6.tar.bz2 pdf-as-3-1318c462d46bb248e0587666c04944cfe2c83db6.zip |
Parsing of PublicAuthority-Flag and PublicAuthority-Code from MOA-VerifyXMLSignatureResponses implemented.
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@295 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter')
5 files changed, 83 insertions, 5 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java index 8593cf1..ab93b94 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -96,7 +96,7 @@ public abstract class PdfAS * The current version of the pdf-as library. This version string is logged on every invocation
* of the api or the web application.
*/
- public static final String PDFAS_VERSION = "3.0.6-20080616";
+ public static final String PDFAS_VERSION = "3.0.6-20080715";
/**
* The key of the strict mode setting.
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java index 6a5c95a..089bfed 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java @@ -102,6 +102,9 @@ public class SignatureResponse private boolean qualifiedCertificate = false;
// [tknall] stop qualified certificate
+ private boolean publicAuthority = false;
+ private String publicAuthorityCode = null;
+
protected String hashInputData = null;
// /**
@@ -214,6 +217,38 @@ public class SignatureResponse }
/**
+ * Returns {@code true} if the underlying certificate indicates public authority.
+ * @return {@code true} if public authority, {@code false} if not.
+ */
+ public boolean isPublicAuthority() {
+ return this.publicAuthority;
+ }
+
+ /**
+ * Sets the public authority flag.
+ * @param publicAuthority The public authority flag.
+ */
+ public void setPublicAuthority(boolean publicAuthority) {
+ this.publicAuthority = publicAuthority;
+ }
+
+ /**
+ * Returns the public authority code of {@code null} if no code was provided.
+ * @return The public authority code.
+ */
+ public String getPublicAuthorityCode() {
+ return this.publicAuthorityCode;
+ }
+
+ /**
+ * Sets the public authority code.
+ * @param publicAuthorityCode The public authority code.
+ */
+ public void setPublicAuthorityCode(String publicAuthorityCode) {
+ this.publicAuthorityCode = publicAuthorityCode;
+ }
+
+/**
* @param signatureManifestCheckCode
* The signatureManifestCheckCode to set.
*/
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java index 5ec7f20..ceeab1b 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java @@ -661,6 +661,28 @@ public class MOAConnector implements Connector // [tknall] start qualified certificate
sig_res.setQualifiedCertificate(cert_qualified_m.find());
// [tknall] stop qualified certificate
+
+ // public authority
+ Pattern publicAuthority_p = Pattern.compile("<PublicAuthority/>");
+ Matcher publicAuthority_m = publicAuthority_p.matcher(xmlResponse);
+ sig_res.setPublicAuthority(false);
+ sig_res.setPublicAuthorityCode(null);
+ if (publicAuthority_m.find()) {
+ sig_res.setPublicAuthority(true);
+ } else {
+ Matcher publicAuthority_m_s = Pattern.compile("<PublicAuthority>").matcher(xmlResponse);
+ Matcher publicAuthority_m_e = Pattern.compile("</PublicAuthority>").matcher(xmlResponse);
+ if (publicAuthority_m_s.find() && publicAuthority_m_e.find()) {
+ sig_res.setPublicAuthority(true);
+ String codePart = xmlResponse.substring(publicAuthority_m_s.end(), publicAuthority_m_e.start());
+ Matcher code_m_s = code_p_s.matcher(codePart);
+ Matcher code_m_e = code_p_e.matcher(codePart);
+ if (code_m_s.find() && code_m_e.find()) {
+ String code = codePart.substring(code_m_s.end(), code_m_e.start());
+ sig_res.setPublicAuthorityCode(code);
+ }
+ }
+ }
if (sub_nam_m_s.find() && sub_nam_m_e.find())
{
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java index 68fcad4..9253955 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java @@ -2,7 +2,6 @@ package at.knowcenter.wag.egov.egiz.sig.connectors.bku; import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
@@ -14,13 +13,12 @@ import java.util.TimeZone; import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import at.gv.egiz.pdfas.exceptions.external.ExternalErrorException;
-import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import at.gv.egiz.pdfas.exceptions.external.ExternalErrorException;
+import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException;
import at.knowcenter.wag.egov.egiz.sig.SignatureData;
import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
@@ -434,6 +432,28 @@ public final class BKUHelper SignatureResponse sig_res = new SignatureResponse();
+ // public authority (tknall)
+ Pattern publicAuthority_p = Pattern.compile("<PublicAuthority/>");
+ Matcher publicAuthority_m = publicAuthority_p.matcher(xmlResponse);
+ sig_res.setPublicAuthority(false);
+ sig_res.setPublicAuthorityCode(null);
+ if (publicAuthority_m.find()) {
+ sig_res.setPublicAuthority(true);
+ } else {
+ Matcher publicAuthority_m_s = Pattern.compile("<PublicAuthority>").matcher(xmlResponse);
+ Matcher publicAuthority_m_e = Pattern.compile("</PublicAuthority>").matcher(xmlResponse);
+ if (publicAuthority_m_s.find() && publicAuthority_m_e.find()) {
+ sig_res.setPublicAuthority(true);
+ String codePart = xmlResponse.substring(publicAuthority_m_s.end(), publicAuthority_m_e.start());
+ Matcher code_m_s = code_p_s.matcher(codePart);
+ Matcher code_m_e = code_p_e.matcher(codePart);
+ if (code_m_s.find() && code_m_e.find()) {
+ String code = codePart.substring(code_m_s.end(), code_m_e.start());
+ sig_res.setPublicAuthorityCode(code);
+ }
+ }
+ }
+
// [tknall] start qualified certificate
sig_res.setQualifiedCertificate(cert_qualified_m.find());
// [tknall] stop qualified certificate
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java index 4cb4ec2..4cc09e1 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java @@ -325,6 +325,7 @@ public class MOASoapWithAttachmentConnector implements Connector // }
// Properties response_properties = MOASoapConnection.connectMOA(request_string, MOASoapConnection.SERVICE_SIGN, url);
+ log.debug("Connecting to " + url);
Properties response_properties = MOASoapConnection.doPostRequestMultipart(url,mode, request_string, data );
// for performance measurement
|