aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-11-26 17:09:49 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-11-26 17:09:49 +0100
commit30a300eda5fbd58c2f2dcb31bf7192ca73183677 (patch)
tree9d9090a2cbe23fe93bce19597ffc095462308509 /pdf-as-lib
parentf94d2743fbe0803e77aebf68db3b156c71e0cda5 (diff)
parent0e89968bf070c4d9602249754ebe1b71a01788b1 (diff)
downloadpdf-as-3-30a300eda5fbd58c2f2dcb31bf7192ca73183677.tar.gz
pdf-as-3-30a300eda5fbd58c2f2dcb31bf7192ca73183677.tar.bz2
pdf-as-3-30a300eda5fbd58c2f2dcb31bf7192ca73183677.zip
Merge remote-tracking branch 'origin/Alex_MOA_1.5.2_changes'
Diffstat (limited to 'pdf-as-lib')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java14
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java10
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java20
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java20
-rw-r--r--pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java20
5 files changed, 82 insertions, 2 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java
index fb48e5e..52aa10f 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java
@@ -81,6 +81,13 @@ public interface VerifyResult extends SignatureInformation
public boolean isQualifiedCertificate();
/**
+ * Returns the null if no secure signing devices was used, or "certificate" or "TSL" if a secure signing devices was used.
+ *
+ * @return Returns the null if no secure signing devices was used, or "certificate" or "TSL" if a secure signing devices was used.
+ */
+ public String getSecureSignatureCreationDevice();
+
+ /**
* Returns {@code true} if public authority is indicated.
* @return {@code true} if public authority.
*/
@@ -176,4 +183,11 @@ public interface VerifyResult extends SignatureInformation
*/
public XMLDsigData getReconstructedXMLDsig();
+ /**
+ * Returns the issuer country code.
+ *
+ * @return Returns the issuer country code.
+ */
+ public String getIssuerCountryCode();
+
}
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java
index 09d247d..713a6dd 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java
@@ -61,7 +61,6 @@ public class VerifyResultAdapter extends SignatureInformationAdapter implements
private String timestamp;
private XMLDsigData xmlDsigData;
-
/**
* Constructor.
@@ -201,5 +200,14 @@ public class VerifyResultAdapter extends SignatureInformationAdapter implements
public XMLDsigData getReconstructedXMLDsig() {
return this.xmlDsigData;
}
+
+
+ public String getSecureSignatureCreationDevice() {
+ return this.sigRes.getSecureSignatureCreationDevice();
+ }
+
+ public String getIssuerCountryCode() {
+ return this.sigRes.getIssuerCountryCode();
+ }
}
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java
index 1756fa3..c294dae 100644
--- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java
+++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java
@@ -111,6 +111,9 @@ public class SignatureResponse
private boolean qualifiedCertificate = false;
// [tknall] stop qualified certificate
+ private String secureSignatureCreationDevice;
+ private String issuerCountryCode;
+
private boolean publicAuthority = false;
private String publicAuthorityCode = null;
@@ -541,6 +544,23 @@ public class SignatureResponse
return props;
}
+
+ public String getSecureSignatureCreationDevice() {
+ return secureSignatureCreationDevice;
+ }
+
+ public void setSecureSignatureCreationDevice(
+ String secureSignatureCreationDevice) {
+ this.secureSignatureCreationDevice = secureSignatureCreationDevice;
+ }
+
+ public String getIssuerCountryCode() {
+ return issuerCountryCode;
+ }
+
+ public void setIssuerCountryCode(String issuerCountryCode) {
+ this.issuerCountryCode = issuerCountryCode;
+ }
/**
* The toString method
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java
index d413a29..a56f807 100644
--- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java
+++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java
@@ -646,6 +646,13 @@ public class MOAConnector implements Connector
Pattern cert_qualified_p = Pattern.compile("<QualifiedCertificate/>");
Matcher cert_qualified_m = cert_qualified_p.matcher(xmlResponse);
// [tknall] stop qualified certificate
+
+ String secureSignatureCreationDevice_certificate = "<SecureSignatureCreationDevice Source=\"Certificate\"/>";//TODO use XPATH
+ String secureSignatureCreationDevice_tsl = "<SecureSignatureCreationDevice Source=\"TSL\"/>";//TODO use XPATH
+ Pattern issuerCountryCode_p_s = Pattern.compile("<IssuerCountryCode>");
+ Pattern issuerCountryCode_p_e = Pattern.compile("</IssuerCountryCode>");
+ Matcher issuerCountryCode_m_s = issuerCountryCode_p_s.matcher(xmlResponse);
+ Matcher issuerCountryCode_m_e = issuerCountryCode_p_e.matcher(xmlResponse);
Pattern sig_chk_p_s = Pattern.compile("<SignatureCheck>");
Pattern sig_chk_p_e = Pattern.compile("</SignatureCheck>");
@@ -682,7 +689,18 @@ public class MOAConnector implements Connector
// [tknall] start qualified certificate
sig_res.setQualifiedCertificate(cert_qualified_m.find());
// [tknall] stop qualified certificate
-
+
+ sig_res.setSecureSignatureCreationDevice(null);//TODO use XPATH
+ if(xmlResponse.contains(secureSignatureCreationDevice_tsl))
+ sig_res.setSecureSignatureCreationDevice("TSL");
+ if(xmlResponse.contains(secureSignatureCreationDevice_certificate))
+ sig_res.setSecureSignatureCreationDevice("Certificate");
+
+ try{
+ String issuerCountry = xmlResponse.substring(issuerCountryCode_m_s.end(), issuerCountryCode_m_e.start());
+ sig_res.setIssuerCountryCode(issuerCountry);
+ }catch(Exception e){logger_.debug("IssuerCountryCode not found in MOA response");}
+
// public authority
Pattern publicAuthority_p = Pattern.compile("<PublicAuthority/>");
Matcher publicAuthority_m = publicAuthority_p.matcher(xmlResponse);
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java
index 908ed57..5aff091 100644
--- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java
+++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java
@@ -458,6 +458,13 @@ public final class BKUHelper
Matcher cert_qualified_m = cert_qualified_p.matcher(xmlResponse);
// [tknall] stop qualified certificate
+ String secureSignatureCreationDevice_certificate = "<SecureSignatureCreationDevice Source=\"Certificate\"/>";//TODO use XPATH
+ String secureSignatureCreationDevice_tsl = "<SecureSignatureCreationDevice Source=\"TSL\"/>";//TODO use XPATH
+ Pattern issuerCountryCode_p_s = Pattern.compile("<IssuerCountryCode>");
+ Pattern issuerCountryCode_p_e = Pattern.compile("</IssuerCountryCode>");
+ Matcher issuerCountryCode_m_s = issuerCountryCode_p_s.matcher(xmlResponse);
+ Matcher issuerCountryCode_m_e = issuerCountryCode_p_e.matcher(xmlResponse);
+
Pattern code_p_s = Pattern.compile("<[\\w]*:?Code>"); //$NON-NLS-1$
Pattern code_p_e = Pattern.compile("</[\\w]*:?Code>"); //$NON-NLS-1$
Pattern info_p_s = Pattern.compile("<[\\w]*:?Info>"); //$NON-NLS-1$
@@ -517,6 +524,19 @@ public final class BKUHelper
sig_res.setQualifiedCertificate(cert_qualified_m.find());
// [tknall] stop qualified certificate
+
+ sig_res.setSecureSignatureCreationDevice(null);//TODO use XPATH
+ if(xmlResponse.contains(secureSignatureCreationDevice_tsl))
+ sig_res.setSecureSignatureCreationDevice("TSL");
+ if(xmlResponse.contains(secureSignatureCreationDevice_certificate))
+ sig_res.setSecureSignatureCreationDevice("Certificate");
+
+ try{
+ String issuerCountry = xmlResponse.substring(issuerCountryCode_m_s.end(), issuerCountryCode_m_e.start());
+ sig_res.setIssuerCountryCode(issuerCountry);
+ }catch(Exception e){log.debug("IssuerCountryCode not found in MOA response");}
+
+
if (hash_data_m_s.find() && hash_data_m_e.find())
{
String hashInputData = xmlResponse.substring(hash_data_m_s.end(), hash_data_m_e.start());