diff options
9 files changed, 116 insertions, 6 deletions
@@ -9,7 +9,7 @@ <groupId>knowcenter</groupId>
<artifactId>pdf-as</artifactId>
<name>PDF-AS</name>
- <version>3.0.6-20080616</version>
+ <version>3.0.6-20080715</version>
<!-- don't forget to set the version string at.knowcenter.wag.egov.egiz.PdfAS.PDFAS_VERSION accordingly -->
<description>Amtssignatur fuer elektronische Aktenfuehrung</description>
diff --git a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java index 06f9c15..fa0e683 100644 --- a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java +++ b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java @@ -40,6 +40,18 @@ public interface VerifyResult extends SignatureInformation * certificate.
*/
public boolean isQualifiedCertificate();
+
+ /**
+ * Returns {@code true} if public authority is indicated.
+ * @return {@code true} if public authority.
+ */
+ public boolean isPublicAuthority();
+
+ /**
+ * Returns the public authority code or {@code null}.
+ * @return The public authority code or {@code null}.
+ */
+ public String getPublicAuthorityCode();
/**
* Returns a list of Strings each stating one public property of the
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java b/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java index 83d4db0..f161b3a 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java @@ -138,4 +138,20 @@ public class VerifyResultAdapter extends SignatureInformationAdapter implements {
return this.sigRes.getHashInputData();
}
+
+
+ /**
+ * @see at.gv.egiz.pdfas.api.verify.VerifyResult#getPublicAuthorityCode()
+ */
+ public String getPublicAuthorityCode() {
+ return this.sigRes.getPublicAuthorityCode();
+ }
+
+ /**
+ * @see at.gv.egiz.pdfas.api.verify.VerifyResult#isPublicAuthority()
+ */
+ public boolean isPublicAuthority() {
+ return this.sigRes.isPublicAuthority();
+ }
+
}
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
diff --git a/src/site/changes.xml b/src/site/changes.xml index 2e7210c..5e50598 100644 --- a/src/site/changes.xml +++ b/src/site/changes.xml @@ -13,6 +13,10 @@ </release>
-->
+ <release version="3.0.6-20080715" date="2008-07-15" description="subsequent release">
+ <action dev="tknall" type="update">Parsing of PublicAuthority-Flag and PublicAuthority-Code from MOA-VerifyXMLSignatureResponses implemented.</action>
+ </release>
+
<release version="3.0.6-20080616" date="2008-06-16" description="subsequent release">
<action dev="tknall" type="update">APIDemo updated.</action>
<action dev="tknall" type="update">(default) configuration updated regarding new configuration keys.</action>
|