aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-06-27 15:50:43 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-06-27 15:50:43 +0200
commit6a75d8fee4aa8628bfa7884821594c8718678cf1 (patch)
treeb194753bc492ff3e750479e81c3b5b7bf8173c9e /moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss
parent451171db528e8d8feff1b3fac7e3f04302b6f59f (diff)
downloadmoa-sig-6a75d8fee4aa8628bfa7884821594c8718678cf1.tar.gz
moa-sig-6a75d8fee4aa8628bfa7884821594c8718678cf1.tar.bz2
moa-sig-6a75d8fee4aa8628bfa7884821594c8718678cf1.zip
return signing time for pdf and ASICMOA-SPSS-3.0.0
Diffstat (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss')
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java3
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java2
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java3
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java18
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java21
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java9
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java4
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java9
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java6
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java7
10 files changed, 71 insertions, 11 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java
index 2d19871..e48d5c3 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/SPSSFactory.java
@@ -1192,7 +1192,8 @@ public abstract class SPSSFactory {
String publicAuthorityID,
boolean sscd,
boolean sscdSourceTSL,
- String issuerCountryCode);
+ String issuerCountryCode,
+ Date signingTime);
/**
* Create a new <code>X509IssuerSerial</code> object.
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java
index 777365a..53850d8 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/common/SignerInfo.java
@@ -25,6 +25,7 @@
package at.gv.egovernment.moa.spss.api.common;
import java.security.cert.X509Certificate;
+import java.util.Date;
/**
@@ -89,4 +90,5 @@ public interface SignerInfo {
*/
public String getPublicAuhtorityID();
+ public Date getSigningTime();
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java
index 4781b8d..b540c18 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java
@@ -522,7 +522,7 @@ public class SPSSFactoryImpl extends SPSSFactory {
public SignerInfo createSignerInfo(X509Certificate signerCertificate, boolean qualifiedCertificate,
boolean qcSourceTSL, boolean publicAuthority, String publicAuthorityID, boolean sscd, boolean sscdSourceTSL,
- String issuerCountryCode) {
+ String issuerCountryCode, Date signingTime) {
SignerInfoImpl signerInfo = new SignerInfoImpl();
signerInfo.setSignerCertificate(signerCertificate);
signerInfo.setQualifiedCertificate(qualifiedCertificate);
@@ -532,6 +532,7 @@ public class SPSSFactoryImpl extends SPSSFactory {
signerInfo.setSSCD(sscd);
signerInfo.setSSCDSourceTSL(sscdSourceTSL);
signerInfo.setIssuerCountryCode(issuerCountryCode);
+ signerInfo.setSigningTime(signingTime);
return signerInfo;
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java
index 7a108e8..cd7bc40 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/impl/SignerInfoImpl.java
@@ -25,6 +25,7 @@
package at.gv.egovernment.moa.spss.api.impl;
import java.security.cert.X509Certificate;
+import java.util.Date;
import at.gv.egovernment.moa.spss.api.common.SignerInfo;
@@ -58,7 +59,9 @@ public class SignerInfoImpl implements SignerInfo {
/** The certificate issuer country code */
private String issuerCountryCode;
-
+
+ private Date signingTime;
+
/**
* Sets the signer certificate.
*
@@ -109,8 +112,16 @@ public class SignerInfoImpl implements SignerInfo {
else
return "Certificate";
}
-
- public void setQCSourceTSL(boolean qcSourceTSL) {
+
+ public Date getSigningTime() {
+ return signingTime;
+ }
+
+ public void setSigningTime(Date signingTime) {
+ this.signingTime = signingTime;
+ }
+
+ public void setQCSourceTSL(boolean qcSourceTSL) {
this.qcSourceTSL = qcSourceTSL;
}
@@ -156,4 +167,5 @@ public class SignerInfoImpl implements SignerInfo {
return publicAuthorityID;
}
+
}
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
index 193ea33..ef5a367 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
@@ -27,7 +27,13 @@ package at.gv.egovernment.moa.spss.api.xmlbind;
import java.io.IOException;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Calendar;
+import java.util.TimeZone;
+import javax.xml.bind.DatatypeConverter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -285,6 +291,21 @@ public class ResponseBuilderUtils {
root.appendChild(codeInfoElem);
}
+ public static void addSigningTime(Document response,
+ Element root,
+ Date signingTime) {
+ if(signingTime != null) {
+ Element extElem = response.createElementNS(MOA_NS_URI, "SigningTime");
+ TimeZone tz = TimeZone.getTimeZone("UTC");
+ Calendar calendar = new GregorianCalendar();
+ calendar.setTimeZone(tz);
+ calendar.setTime(signingTime);
+ String date = DatatypeConverter.printDateTime(calendar);
+ extElem.appendChild(response.createTextNode(date));
+ root.appendChild(extElem);
+ }
+ }
+
public static void addExtendendResult(Document response,
Element root,
ExtendedCertificateCheckResult result) {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java
index 5bc7bec..b74ab38 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyCMSSignatureResponseBuilder.java
@@ -51,6 +51,7 @@ public class VerifyCMSSignatureResponseBuilder {
private Document responseDoc;
/** The response <code>VerifyCMSSignatureResponse</code> DOM element. */
private Element responseElem;
+ private boolean includeSigningTime = false;
/**
* Create a new <code>VerifyCMSSignatureResponseBuilder</code>:
@@ -64,9 +65,10 @@ public class VerifyCMSSignatureResponseBuilder {
responseElem = responseDoc.getDocumentElement();
}
- public VerifyCMSSignatureResponseBuilder(Document responseDoc, String name) throws MOASystemException {
+ public VerifyCMSSignatureResponseBuilder(Document responseDoc, String name, boolean includeSigningTime) throws MOASystemException {
this.responseDoc = responseDoc;
responseElem = responseDoc.createElementNS(Constants.MOA_NS_URI, name);
+ this.includeSigningTime = includeSigningTime;
}
public Element buildElement(VerifyCMSSignatureResponse response) throws MOAApplicationException {
@@ -124,6 +126,11 @@ public class VerifyCMSSignatureResponseBuilder {
signerInfo.getSSCDSource(),
signerInfo.getIssuerCountryCode());
+ if(this.includeSigningTime) {
+ ResponseBuilderUtils.addSigningTime(responseDoc,
+ responseElem, signerInfo.getSigningTime());
+ }
+
ResponseBuilderUtils.addCodeInfoElement(
responseDoc,
responseElem,
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
index 1826ffc..f60d86f 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
@@ -112,6 +112,10 @@ public class VerifyPDFSignatureResponseBuilder {
signerInfo.getSSCDSource(),
signerInfo.getIssuerCountryCode());
+ ResponseBuilderUtils.addSigningTime(responseDoc,
+ responseElem,
+ signerInfo.getSigningTime());
+
ResponseBuilderUtils.addCodeInfoElement(
responseDoc,
responseElem,
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java
index 771c276..716cca1 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyXMLSignatureResponseBuilder.java
@@ -63,6 +63,7 @@ public class VerifyXMLSignatureResponseBuilder {
/** The response <code>VerifyXMLSignatureResponse</code> DOM element. */
private Element responseElem;
+ private boolean includeSigningTime = false;
/**
* Create a new <code>VerifyXMLSignatureResponseBuilder</code>:
*
@@ -74,9 +75,10 @@ public class VerifyXMLSignatureResponseBuilder {
responseElem = responseDoc.getDocumentElement();
}
- public VerifyXMLSignatureResponseBuilder(Document responseDoc, String name) throws MOASystemException {
+ public VerifyXMLSignatureResponseBuilder(Document responseDoc, String name, boolean includeSigningTime) throws MOASystemException {
this.responseDoc = responseDoc;
responseElem = responseDoc.createElementNS(MOA_NS_URI, name);
+ this.includeSigningTime = includeSigningTime;
}
public Element buildElement(VerifyXMLSignatureResponse response) throws MOAApplicationException {
@@ -108,6 +110,11 @@ public class VerifyXMLSignatureResponseBuilder {
response.getSignerInfo().isSSCD(), response.getSignerInfo().getSSCDSource(),
response.getSignerInfo().getIssuerCountryCode());
+ if(this.includeSigningTime) {
+ ResponseBuilderUtils.addSigningTime(responseDoc,
+ responseElem, response.getSignerInfo().getSigningTime());
+ }
+
// add HashInputData elements
responseData = response.getHashInputDatas();
if (responseData != null && !responseData.isEmpty()) {
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java
index 7b4a350..fe2a9ad 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyCMSSignatureResponseBuilder.java
@@ -108,7 +108,8 @@ public class VerifyCMSSignatureResponseBuilder {
certResult.getPublicAuthorityID(),
checkSSCD,
sscdSourceTSL,
- issuerCountryCode);
+ issuerCountryCode,
+ result.getSigningTime());
// add SignatureCheck element
signatureCheck = factory.createCheckResult(signatureCheckCode, null);
@@ -167,7 +168,8 @@ public class VerifyCMSSignatureResponseBuilder {
certResult.getPublicAuthorityID(),
checkSSCD,
sscdSourceTSL,
- issuerCountryCode);
+ issuerCountryCode,
+ result.getSigningTime());
// add SignatureCheck element
signatureCheck = factory.createCheckResult(signatureCheckCode, null);
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java
index 7bd7c27..789336e 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/VerifyXMLSignatureResponseBuilder.java
@@ -30,6 +30,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Date;
import javax.xml.crypto.OctetStreamData;
import javax.xml.crypto.dsig.CanonicalizationMethod;
@@ -103,6 +104,7 @@ public class VerifyXMLSignatureResponseBuilder {
private CheckResult certificateCheck;
private List adesFormResults = null;
private ExtendedCertificateCheckResult extCheckResult = null;
+ private Date signingTime;
/**
* Get the <code>VerifyMLSignatureResponse</code> built so far.
*
@@ -184,7 +186,8 @@ public class VerifyXMLSignatureResponseBuilder {
certResult.getPublicAuthorityID(),
checkSSCD,
sscdSourceTSL,
- issuerCountryCode);
+ issuerCountryCode,
+ result.getSigningTime());
// Create HashInputData Content objects
referenceDataList = result.getReferenceDataList();
@@ -331,7 +334,7 @@ public class VerifyXMLSignatureResponseBuilder {
// create the certificate check
this.certificateCheck = certificateCheck;
-
+ this.signingTime = result.getSigningTime();
}