summaryrefslogtreecommitdiff
path: root/eaaf_modules/eaaf_module_moa-sig/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_modules/eaaf_module_moa-sig/src/main/java')
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/ISignatureVerificationService.java88
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ICmsSignatureVerificationResponse.java (renamed from eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ICMSSignatureVerificationResponse.java)2
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IGenericSignatureVerificationResponse.java27
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ISchemaRessourceProvider.java10
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IXmlSignatureVerificationResponse.java (renamed from eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IXMLSignatureVerificationResponse.java)17
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/AbstractSignatureService.java23
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/MoaSigInitializer.java28
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/MoaSigSpringResourceProvider.java2
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/SignatureCreationService.java7
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/SignatureVerificationService.java104
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/GenericSignatureVerificationResponse.java57
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyCmsSignatureResponse.java (renamed from eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyCMSSignatureResponse.java)6
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyXMLSignatureResponse.java119
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyXmlSignatureResponse.java115
-rw-r--r--eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/parser/VerifyXmlSignatureResponseParser.java57
15 files changed, 341 insertions, 321 deletions
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/ISignatureVerificationService.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/ISignatureVerificationService.java
index 155bfadd..67e9e29d 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/ISignatureVerificationService.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/ISignatureVerificationService.java
@@ -1,8 +1,9 @@
package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api;
import java.util.List;
-import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.ICMSSignatureVerificationResponse;
-import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.IXMLSignatureVerificationResponse;
+
+import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.ICmsSignatureVerificationResponse;
+import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.IXmlSignatureVerificationResponse;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceException;
public interface ISignatureVerificationService {
@@ -10,80 +11,89 @@ public interface ISignatureVerificationService {
/**
* Verify a CAdES or CMS signature. <br>
* <br>
- * <i>This method only validates the first CMS or CAdES signature if more than one signature
- * exists</i>
+ * <i>This method only validates the first CMS or CAdES signature if more than
+ * one signature exists</i>
*
- * @param signature Enveloped CMS or CAdES signature
+ * @param signature Enveloped CMS or CAdES signature
* @param trustProfileID Id of the Trust-Profile from MOA-Sig configuration
- * @return @link {@link ICMSSignatureVerificationResponse}, or null if no signature was found
+ * @return @link {@link ICmsSignatureVerificationResponse}, or null if no
+ * signature was found
* @throws MoaSigServiceException on signatue-verification error
*/
- ICMSSignatureVerificationResponse verifyCmsSignature(byte[] signature, String trustProfileID)
+ ICmsSignatureVerificationResponse verifyCmsSignature(byte[] signature, String trustProfileID)
throws MoaSigServiceException;
-
-
/**
* Verify a XML or XAdES signature. <br>
* <br>
- * <i>This method only validates the first XML or XAdES signature if more than one signature
- * exists</i>
+ * <i>This method only validates the first XML or XAdES signature if more than
+ * one signature exists</i>
*
- * @param signature Serialized XML or XAdES signature
+ * @param signature Serialized XML or XAdES signature
* @param trustProfileID Id of the Trust-Profile from MOA-Sig configuration
- * @return @link {@link IXMLSignatureVerificationResponse}, or null if no signature was found
+ * @return @link {@link IXmlSignatureVerificationResponse}, or null if no
+ * signature was found
* @throws MoaSigServiceException on signatue-verification error
*/
- IXMLSignatureVerificationResponse verifyXmlSignature(byte[] signature, String trustProfileID)
+ IXmlSignatureVerificationResponse verifyXmlSignature(byte[] signature, String trustProfileID)
throws MoaSigServiceException;
/**
* Verify a XML or XAdES signature. <br>
* <br>
- * <i>This method only validates the first XML or XAdES signature if more than one signature
- * exists</i>
+ * <i>This method only validates the first XML or XAdES signature if more than
+ * one signature exists</i>
*
- * @param signature Serialized XML or XAdES signature
- * @param trustProfileID Id of the Trust-Profile from MOA-Sig configuration
- * @param verifyTransformsInfoProfileID {@link List} of XML Transformations that should be used
- * for signature-verification
- * @return @link {@link IXMLSignatureVerificationResponse}, or null if no signature was found
+ * @param signature Serialized XML or XAdES signature
+ * @param trustProfileID Id of the Trust-Profile from MOA-Sig
+ * configuration
+ * @param verifyTransformsInfoProfileID {@link List} of XML Transformations that
+ * should be used for
+ * signature-verification
+ * @return @link {@link IXmlSignatureVerificationResponse}, or null if no
+ * signature was found
* @throws MoaSigServiceException on signatue-verification error
*/
- IXMLSignatureVerificationResponse verifyXmlSignature(byte[] signature, String trustProfileID,
+ IXmlSignatureVerificationResponse verifyXmlSignature(byte[] signature, String trustProfileID,
List<String> verifyTransformsInfoProfileID) throws MoaSigServiceException;
-
/**
* Verify a XML or XAdES signature. <br>
* <br>
- * <i>This method only validates the first XML or XAdES signature if more than one signature
- * exists</i>
+ * <i>This method only validates the first XML or XAdES signature if more than
+ * one signature exists</i>
*
- * @param signature Serialized XML or XAdES signature
- * @param trustProfileID Id of the Trust-Profile from MOA-Sig configuration
- * @param signatureLocationXpath Xpath that points to location of Signature element
- * @return @link {@link IXMLSignatureVerificationResponse}, or null if no signature was found
+ * @param signature Serialized XML or XAdES signature
+ * @param trustProfileID Id of the Trust-Profile from MOA-Sig
+ * configuration
+ * @param signatureLocationXpath Xpath that points to location of Signature
+ * element
+ * @return @link {@link IXmlSignatureVerificationResponse}, or null if no
+ * signature was found
* @throws MoaSigServiceException on signatue-verification error
*/
- IXMLSignatureVerificationResponse verifyXmlSignature(byte[] signature, String trustProfileID,
+ IXmlSignatureVerificationResponse verifyXmlSignature(byte[] signature, String trustProfileID,
String signatureLocationXpath) throws MoaSigServiceException;
/**
* Verify a XML or XAdES signature. <br>
* <br>
- * <i>This method only validates the first XML or XAdES signature if more than one signature
- * exists</i>
+ * <i>This method only validates the first XML or XAdES signature if more than
+ * one signature exists</i>
*
- * @param signature Serialized XML or XAdES signature
- * @param trustProfileID Id of the Trust-Profile from MOA-Sig configuration
- * @param verifyTransformsInfoProfileID {@link List} of XML Transformations that should be used
- * for signature-verification
- * @param signatureLocationXpath Xpath that points to location of Signature element
- * @return @link {@link IXMLSignatureVerificationResponse}, or null if no signature was found
+ * @param signature Serialized XML or XAdES signature
+ * @param trustProfileID Id of the Trust-Profile from MOA-Sig
+ * configuration
+ * @param verifyTransformsInfoProfileID {@link List} of XML Transformations that
+ * should be used for
+ * signature-verification
+ * @param signatureLocationXpath Xpath that points to location of
+ * Signature element
+ * @return @link {@link IXmlSignatureVerificationResponse}, or null if no
+ * signature was found
* @throws MoaSigServiceException on signatue-verification error
*/
- IXMLSignatureVerificationResponse verifyXmlSignature(byte[] signature, String trustProfileID,
+ IXmlSignatureVerificationResponse verifyXmlSignature(byte[] signature, String trustProfileID,
List<String> verifyTransformsInfoProfileID, String signatureLocationXpath)
throws MoaSigServiceException;
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ICMSSignatureVerificationResponse.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ICmsSignatureVerificationResponse.java
index 57426751..5e7a4564 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ICMSSignatureVerificationResponse.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ICmsSignatureVerificationResponse.java
@@ -1,5 +1,5 @@
package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data;
-public interface ICMSSignatureVerificationResponse extends IGenericSignatureVerificationResponse {
+public interface ICmsSignatureVerificationResponse extends IGenericSignatureVerificationResponse {
}
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IGenericSignatureVerificationResponse.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IGenericSignatureVerificationResponse.java
index 13a9b08f..8ebd90be 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IGenericSignatureVerificationResponse.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IGenericSignatureVerificationResponse.java
@@ -1,18 +1,17 @@
package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data;
-import iaik.x509.X509Certificate;
import java.util.Date;
import org.springframework.lang.Nullable;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceException;
-
+import iaik.x509.X509Certificate;
public interface IGenericSignatureVerificationResponse {
/**
- * Returns the signing time
- *
+ * Returns the signing time.
+ *
* @return Signing time, or null if signature contains no time information
*/
@Nullable
@@ -20,53 +19,53 @@ public interface IGenericSignatureVerificationResponse {
/**
* Returns the signatureCheckCode.
- *
+ *
* @return int
*/
int getSignatureCheckCode();
/**
* Returns the certificateCheckCode.
- *
+ *
* @return int
*/
int getCertificateCheckCode();
/**
* Returns the qualifiedCertificate.
- *
+ *
* @return boolean
*/
boolean isQualifiedCertificate();
/**
* Returns the X509 certificate.
- *
+ *
* @return X509Certificate, or null if no certificate information exists
* @throws MoaSigServiceException if X509 certificate can not be deserialized
*/
@Nullable
X509Certificate getX509Certificate() throws MoaSigServiceException;
-
/**
- * Returns the X509 certificate in serialized form
- *
- * @return Serialized X509 certificate, or null if no certificate information exists
+ * Returns the X509 certificate in serialized form.
+ *
+ * @return Serialized X509 certificate, or null if no certificate information
+ * exists
*/
@Nullable
byte[] getX509CertificateEncoded();
/**
* Returns the publicAuthority.
- *
+ *
* @return boolean
*/
boolean isPublicAuthority();
/**
* Returns the publicAuthorityCode.
- *
+ *
* @return String OID, or null if no OID exists
*/
@Nullable
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ISchemaRessourceProvider.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ISchemaRessourceProvider.java
index 49940ca5..17d5fa59 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ISchemaRessourceProvider.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/ISchemaRessourceProvider.java
@@ -4,7 +4,7 @@ import java.io.InputStream;
import java.util.Map;
/**
- * Inject additional XML schemes into MOA-Sig
+ * Inject additional XML schemes into MOA-Sig.
*
* @author tlenz
*
@@ -12,10 +12,10 @@ import java.util.Map;
public interface ISchemaRessourceProvider {
/**
- * Get a Map of additional XML schemes that should be injected into MOA-Sig
- *
- * @return A Set of {@link Entry} consist of Name of the Scheme and XML scheme as
- * {@link InputStream}
+ * Get a Map of additional XML schemes that should be injected into MOA-Sig.
+ *
+ * @return A Set of {@link Entry} consist of Name of the Scheme and XML scheme
+ * as {@link InputStream}
*/
Map<String, InputStream> getSchemas();
}
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IXMLSignatureVerificationResponse.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IXmlSignatureVerificationResponse.java
index 6273bb9e..5b766917 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IXMLSignatureVerificationResponse.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/api/data/IXmlSignatureVerificationResponse.java
@@ -1,34 +1,33 @@
package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data;
/**
+ * XML signature verification result.
+ *
* @author tlenz
*
*/
-public interface IXMLSignatureVerificationResponse extends IGenericSignatureVerificationResponse {
-
+public interface IXmlSignatureVerificationResponse extends IGenericSignatureVerificationResponse {
/**
* Returns the xmlDSIGManifestCheckCode.
- *
+ *
* @return int
*/
- int getXmlDSIGManifestCheckCode();
+ int getXmlDsigManifestCheckCode();
/**
* Returns the xmlDsigSubjectName.
- *
+ *
* @return String
*/
String getXmlDsigSubjectName();
-
/**
* Returns the xmlDSIGManigest.
- *
+ *
* @return boolean
*/
- boolean isXmlDSIGManigest();
-
+ boolean isXmlDsigManigest();
/**
* Returns the the resulting code of the signature manifest check.
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/AbstractSignatureService.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/AbstractSignatureService.java
index cbf80c39..d2cab2ef 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/AbstractSignatureService.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/AbstractSignatureService.java
@@ -3,6 +3,12 @@ package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.w3c.dom.Document;
+
import at.gv.egovernment.moa.spss.server.config.ConfigurationException;
import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator;
@@ -10,10 +16,6 @@ import at.gv.egovernment.moa.spss.server.transaction.TransactionContext;
import at.gv.egovernment.moa.spss.server.transaction.TransactionContextManager;
import at.gv.egovernment.moaspss.logging.LoggingContext;
import at.gv.egovernment.moaspss.logging.LoggingContextManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.w3c.dom.Document;
public abstract class AbstractSignatureService {
private static final Logger log = LoggerFactory.getLogger(AbstractSignatureService.class);
@@ -22,8 +24,9 @@ public abstract class AbstractSignatureService {
MoaSigInitializer moaSigConfig;
/**
- * Get a new {@link Document} from {@link DocumentBuilder} in synchronized form, because
- * {@link DocumentBuilderFactory} and {@link DocumentBuilder} are not thread-safe.
+ * Get a new {@link Document} from {@link DocumentBuilder} in synchronized form,
+ * because {@link DocumentBuilderFactory} and {@link DocumentBuilder} are not
+ * thread-safe.
*
* @return {@link Document}
* @throws ParserConfigurationException In case of an error
@@ -35,11 +38,11 @@ public abstract class AbstractSignatureService {
}
/**
- * Set up the thread-local context information needed for calling the various <code>Invoker</code>
- * classes.
+ * Set up the thread-local context information needed for calling the various
+ * <code>Invoker</code> classes.
*
- * @throws ConfigurationException An error occurred setting up the configuration in the
- * <code>TransactionContext</code>.
+ * @throws ConfigurationException An error occurred setting up the configuration
+ * in the <code>TransactionContext</code>.
*/
protected final void setUpContexts(final String transactionID) throws ConfigurationException {
final TransactionContextManager txMgr = TransactionContextManager.getInstance();
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/MoaSigInitializer.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/MoaSigInitializer.java
index f0ee4612..77bbc88b 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/MoaSigInitializer.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/MoaSigInitializer.java
@@ -6,8 +6,14 @@ import java.security.Provider;
import java.security.Security;
import java.util.Iterator;
import java.util.Map.Entry;
+
import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.ISchemaRessourceProvider;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceConfigurationException;
import at.gv.egovernment.moa.spss.MOAException;
@@ -15,9 +21,6 @@ import at.gv.egovernment.moa.spss.api.Configurator;
import at.gv.egovernment.moaspss.logging.LoggingContext;
import at.gv.egovernment.moaspss.logging.LoggingContextManager;
import at.gv.egovernment.moaspss.util.DOMUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import iaik.asn1.structures.AlgorithmID;
import iaik.security.ec.provider.ECCelerate;
import iaik.security.provider.IAIK;
@@ -30,7 +33,6 @@ public class MoaSigInitializer {
private Configurator moaSigConfigurator;
-
/**
* Get MOA-Sig configuration object.
*
@@ -76,7 +78,6 @@ public class MoaSigInitializer {
}
-
// Inject additional XML schemes
if (schemas != null && schemas.length > 0) {
log.debug("Infjecting additional XML schemes ... ");
@@ -100,30 +101,29 @@ public class MoaSigInitializer {
moaSigConfigurator = Configurator.getInstance();
-
} catch (final MOAException e) {
log.error("MOA-SP initialization FAILED!", e.getWrapped());
throw new MoaSigServiceConfigurationException("service.moasig.04",
- new Object[] {e.toString()}, e);
+ new Object[] { e.toString() }, e);
}
-
}
private static void fixJava8_141ProblemWithSslAlgorithms() {
log.info("Change AlgorithmIDs to fix problems with Java8 >= 141 ...");
- // new AlgorithmID("1.2.840.113549.1.1.4", "md5WithRSAEncryption", new String[] { "MD5withRSA",
+ // new AlgorithmID("1.2.840.113549.1.1.4", "md5WithRSAEncryption", new String[]
+ // { "MD5withRSA",
// "MD5/RSA", }, null, true);
new AlgorithmID("1.2.840.113549.1.1.5", "sha1WithRSAEncryption",
- new String[] {"SHA1withRSA", "SHA1/RSA", "SHA-1/RSA", "SHA/RSA",}, null, true);
+ new String[] { "SHA1withRSA", "SHA1/RSA", "SHA-1/RSA", "SHA/RSA", }, null, true);
new AlgorithmID("1.2.840.113549.1.1.14", "sha224WithRSAEncryption",
- new String[] {"SHA224withRSA", "SHA224/RSA", "SHA-224/RSA",}, null, true);
+ new String[] { "SHA224withRSA", "SHA224/RSA", "SHA-224/RSA", }, null, true);
new AlgorithmID("1.2.840.113549.1.1.11", "sha256WithRSAEncryption",
- new String[] {"SHA256withRSA", "SHA256/RSA", "SHA-256/RSA",}, null, true);
+ new String[] { "SHA256withRSA", "SHA256/RSA", "SHA-256/RSA", }, null, true);
new AlgorithmID("1.2.840.113549.1.1.12", "sha384WithRSAEncryption",
- new String[] {"SHA384withRSA", "SHA384/RSA", "SHA-384/RSA",}, null, true);
+ new String[] { "SHA384withRSA", "SHA384/RSA", "SHA-384/RSA", }, null, true);
new AlgorithmID("1.2.840.113549.1.1.13", "sha512WithRSAEncryption",
- new String[] {"SHA512withRSA", "SHA512/RSA", "SHA-512/RSA"}, null, true);
+ new String[] { "SHA512withRSA", "SHA512/RSA", "SHA-512/RSA" }, null, true);
log.info("Change AlgorithmIDs finished");
}
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/MoaSigSpringResourceProvider.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/MoaSigSpringResourceProvider.java
index c8275264..d09b26de 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/MoaSigSpringResourceProvider.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/MoaSigSpringResourceProvider.java
@@ -11,7 +11,7 @@ public class MoaSigSpringResourceProvider implements SpringResourceProvider {
public Resource[] getResourcesToLoad() {
final ClassPathResource moaSigConfig =
new ClassPathResource("/moa-sig-service.beans.xml", MoaSigSpringResourceProvider.class);
- return new Resource[] {moaSigConfig};
+ return new Resource[] { moaSigConfig };
}
@Override
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/SignatureCreationService.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/SignatureCreationService.java
index 338e77d8..559af62a 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/SignatureCreationService.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/SignatureCreationService.java
@@ -18,17 +18,14 @@ public class SignatureCreationService extends AbstractSignatureService
private XMLSignatureCreationInvoker xadesInvoker;
private CMSSignatureCreationInvoker cadesInvoker;
-
-
@PostConstruct
protected void internalInitializer() {
log.debug("Instanzing SignatureCreationService implementation ... ");
xadesInvoker = XMLSignatureCreationInvoker.getInstance();
cadesInvoker = CMSSignatureCreationInvoker.getInstance();
- log.trace("XML_impl: {} , CMS_imp: {}",
- xadesInvoker.getClass().getName(), cadesInvoker.getClass().getName());
+ log.trace("XML_impl: {} , CMS_imp: {}",
+ xadesInvoker.getClass().getName(), cadesInvoker.getClass().getName());
log.info("MOA-Sig signature-creation service initialized");
-
}
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/SignatureVerificationService.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/SignatureVerificationService.java
index 3dbda391..8fc4086e 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/SignatureVerificationService.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/SignatureVerificationService.java
@@ -3,10 +3,21 @@ package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl;
import java.io.ByteArrayInputStream;
import java.security.cert.CertificateEncodingException;
import java.util.List;
+
import javax.annotation.PostConstruct;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.lang.Nullable;
+import org.springframework.stereotype.Service;
+import org.springframework.util.Base64Utils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.ISignatureVerificationService;
-import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.ICMSSignatureVerificationResponse;
-import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.IXMLSignatureVerificationResponse;
+import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.ICmsSignatureVerificationResponse;
+import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.IXmlSignatureVerificationResponse;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceBuilderException;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceException;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.parser.VerifyXmlSignatureResponseParser;
@@ -22,15 +33,6 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse;
import at.gv.egovernment.moa.spss.server.invoke.CMSSignatureVerificationInvoker;
import at.gv.egovernment.moa.spss.server.invoke.XMLSignatureVerificationInvoker;
import at.gv.egovernment.moaspss.util.Constants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.lang.Nullable;
-import org.springframework.stereotype.Service;
-import org.springframework.util.Base64Utils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
/**
* MOA-Sig based signature verification implementation.
@@ -54,12 +56,12 @@ public class SignatureVerificationService extends AbstractSignatureService
/*
* (non-Javadoc)
*
- * @see at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.ISignatureVerificationService#
- * verifyCMSSignature(byte[], java.lang.String)
+ * @see at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.
+ * ISignatureVerificationService# verifyCMSSignature(byte[], java.lang.String)
*/
@Override
@Nullable
- public ICMSSignatureVerificationResponse verifyCmsSignature(final byte[] signature,
+ public ICmsSignatureVerificationResponse verifyCmsSignature(final byte[] signature,
final String trustProfileID) throws MoaSigServiceException {
try {
// setup context
@@ -74,12 +76,12 @@ public class SignatureVerificationService extends AbstractSignatureService
} catch (final MOAException e) {
log.warn("CMS signature verification has an error.", e);
- throw new MoaSigServiceException("service.03", new Object[] {e.toString()}, e);
+ throw new MoaSigServiceException("service.03", new Object[] { e.toString() }, e);
} catch (final CertificateEncodingException e) {
log.warn("Can NOT serialize X509 certificate from CMS/CAdES signature-verification response",
e);
- throw new MoaSigServiceException("service.03", new Object[] {e.toString()}, e);
+ throw new MoaSigServiceException("service.03", new Object[] { e.toString() }, e);
} finally {
tearDownContexts();
@@ -91,11 +93,11 @@ public class SignatureVerificationService extends AbstractSignatureService
/*
* (non-Javadoc)
*
- * @see at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.ISignatureVerificationService#
- * verifyXMLSignature(byte[], java.lang.String)
+ * @see at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.
+ * ISignatureVerificationService# verifyXMLSignature(byte[], java.lang.String)
*/
@Override
- public IXMLSignatureVerificationResponse verifyXmlSignature(final byte[] signature,
+ public IXmlSignatureVerificationResponse verifyXmlSignature(final byte[] signature,
final String trustProfileID) throws MoaSigServiceException {
return verifyXmlSignature(signature, trustProfileID, null, DEFAULT_XPATH_SIGNATURE_LOCATION);
@@ -104,11 +106,12 @@ public class SignatureVerificationService extends AbstractSignatureService
/*
* (non-Javadoc)
*
- * @see at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.ISignatureVerificationService#
- * verifyXMLSignature(byte[], java.lang.String, java.util.List)
+ * @see at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.
+ * ISignatureVerificationService# verifyXMLSignature(byte[], java.lang.String,
+ * java.util.List)
*/
@Override
- public IXMLSignatureVerificationResponse verifyXmlSignature(final byte[] signature,
+ public IXmlSignatureVerificationResponse verifyXmlSignature(final byte[] signature,
final String trustProfileID, final List<String> verifyTransformsInfoProfileID)
throws MoaSigServiceException {
return verifyXmlSignature(signature, trustProfileID, verifyTransformsInfoProfileID,
@@ -118,11 +121,12 @@ public class SignatureVerificationService extends AbstractSignatureService
/*
* (non-Javadoc)
*
- * @see at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.ISignatureVerificationService#
- * verifyXMLSignature(byte[], java.lang.String, java.lang.String)
+ * @see at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.
+ * ISignatureVerificationService# verifyXMLSignature(byte[], java.lang.String,
+ * java.lang.String)
*/
@Override
- public IXMLSignatureVerificationResponse verifyXmlSignature(final byte[] signature,
+ public IXmlSignatureVerificationResponse verifyXmlSignature(final byte[] signature,
final String trustProfileID, final String signatureLocationXpath)
throws MoaSigServiceException {
return verifyXmlSignature(signature, trustProfileID, null, signatureLocationXpath);
@@ -131,11 +135,12 @@ public class SignatureVerificationService extends AbstractSignatureService
/*
* (non-Javadoc)
*
- * @see at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.ISignatureVerificationService#
- * verifyXMLSignature(byte[], java.lang.String, java.util.List, java.lang.String)
+ * @see at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.
+ * ISignatureVerificationService# verifyXMLSignature(byte[], java.lang.String,
+ * java.util.List, java.lang.String)
*/
@Override
- public IXMLSignatureVerificationResponse verifyXmlSignature(final byte[] signature,
+ public IXmlSignatureVerificationResponse verifyXmlSignature(final byte[] signature,
final String trustProfileID, final List<String> verifyTransformsInfoProfileID,
final String xpathSignatureLocation) throws MoaSigServiceException {
try {
@@ -153,7 +158,7 @@ public class SignatureVerificationService extends AbstractSignatureService
final Document result = new VerifyXMLSignatureResponseBuilder(true).build(vsresponse);
// parses the <IXMLSignatureVerificationResponse>
- final IXMLSignatureVerificationResponse verifyXmlSignatureResponse =
+ final IXmlSignatureVerificationResponse verifyXmlSignatureResponse =
new VerifyXmlSignatureResponseParser(result.getDocumentElement()).parseData();
return verifyXmlSignatureResponse;
@@ -164,7 +169,7 @@ public class SignatureVerificationService extends AbstractSignatureService
} catch (final MOAException e) {
log.warn("MOA-Sig signature-verification has an internal error." + " MsgCode: "
+ e.getMessageId() + " Msg: " + e.getMessage(), e);
- throw new MoaSigServiceException("service.moasig.03", new Object[] {e.getMessage()}, e);
+ throw new MoaSigServiceException("service.moasig.03", new Object[] { e.getMessage() }, e);
} finally {
tearDownContexts();
@@ -172,7 +177,7 @@ public class SignatureVerificationService extends AbstractSignatureService
}
}
- private ICMSSignatureVerificationResponse parseCmsVerificationResult(
+ private ICmsSignatureVerificationResponse parseCmsVerificationResult(
final VerifyCMSSignatureResponse cmsSigVerifyResp) throws CertificateEncodingException {
if (cmsSigVerifyResp.getResponseElements() == null
@@ -190,8 +195,8 @@ public class SignatureVerificationService extends AbstractSignatureService
final VerifyCMSSignatureResponseElement firstSig =
(VerifyCMSSignatureResponseElement) cmsSigVerifyResp.getResponseElements().get(0);
- final at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.data.VerifyCMSSignatureResponse result =
- new at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.data.VerifyCMSSignatureResponse();
+ final at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.data.VerifyCmsSignatureResponse result =
+ new at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.data.VerifyCmsSignatureResponse();
// parse results into response container
result.setSignatureCheckCode(firstSig.getSignatureCheck().getCode());
@@ -216,14 +221,16 @@ public class SignatureVerificationService extends AbstractSignatureService
/**
* Build a VerifyCMS-Siganture request for MOA-Sig. <br>
* <br>
- * This builder only generates verification-request for enveloped CMS or CAdES signatures <br>
+ * This builder only generates verification-request for enveloped CMS or CAdES
+ * signatures <br>
* This
*
- * @param signature CMS or CAdES signature
- * @param trustProfileID trustProfileID MOA-Sig Trust-Profile
- * @param isPdfSignature Make CAdES signature as part of an PAdES document
- * @param performExtendedValidation To extended validation. See MOA-Sig documentation for detailed
- * information
+ * @param signature CMS or CAdES signature
+ * @param trustProfileID trustProfileID MOA-Sig Trust-Profile
+ * @param isPdfSignature Make CAdES signature as part of an PAdES
+ * document
+ * @param performExtendedValidation To extended validation. See MOA-Sig
+ * documentation for detailed information
* @return
*/
private VerifyCMSSignatureRequest buildVerfifyCmsRequest(final byte[] signature,
@@ -245,11 +252,12 @@ public class SignatureVerificationService extends AbstractSignatureService
/**
* Build a VerifyXML-Signature request for MOA-Sig.
*
- * @param signature Serialized XML signature
- * @param trustProfileID MOA-Sig Trust-Profile
- * @param verifyTransformsInfoProfileID {@link List} of Transformation-Profiles used for
- * validation
- * @param xpathSignatureLocation Xpath that points to location of Signature element
+ * @param signature Serialized XML signature
+ * @param trustProfileID MOA-Sig Trust-Profile
+ * @param verifyTransformsInfoProfileID {@link List} of Transformation-Profiles
+ * used for validation
+ * @param xpathSignatureLocation Xpath that points to location of
+ * Signature element
* @return MOA-Sig verification request element
* @throws MoaSigServiceBuilderException In case of an error
*/
@@ -266,7 +274,6 @@ public class SignatureVerificationService extends AbstractSignatureService
Constants.DSIG_NS_URI);
requestDoc_.appendChild(requestElem_);
-
// build the request
final Element verifiySignatureInfoElem =
requestDoc_.createElementNS(MOA_NS_URI, "VerifySignatureInfo");
@@ -331,19 +338,18 @@ public class SignatureVerificationService extends AbstractSignatureService
} catch (final Throwable t) {
log.warn("Can NOT build VerifyXML-Signature request for MOA-Sig", t);
- throw new MoaSigServiceBuilderException("service.moasig.03", new Object[] {t.getMessage()},
+ throw new MoaSigServiceBuilderException("service.moasig.03", new Object[] { t.getMessage() },
t);
}
}
-
-
@PostConstruct
protected void internalInitializer() {
log.debug("Instanzing SignatureVerificationService implementation ... ");
- // svs = at.gv.egovernment.moa.spss.api.SignatureVerificationService.getInstance();
+ // svs =
+ // at.gv.egovernment.moa.spss.api.SignatureVerificationService.getInstance();
cadesInvoker = CMSSignatureVerificationInvoker.getInstance();
xadesInvocer = XMLSignatureVerificationInvoker.getInstance();
log.info("MOA-Sig signature-verification service initialized");
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/GenericSignatureVerificationResponse.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/GenericSignatureVerificationResponse.java
index 18ee6edb..0485f31f 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/GenericSignatureVerificationResponse.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/GenericSignatureVerificationResponse.java
@@ -2,7 +2,6 @@ package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.data;
import java.io.Serializable;
import java.security.cert.CertificateException;
-import iaik.x509.X509Certificate;
import java.util.Date;
import org.slf4j.Logger;
@@ -11,6 +10,7 @@ import org.slf4j.LoggerFactory;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.IGenericSignatureVerificationResponse;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceException;
import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceParserException;
+import iaik.x509.X509Certificate;
public class GenericSignatureVerificationResponse
implements IGenericSignatureVerificationResponse, Serializable {
@@ -19,32 +19,31 @@ public class GenericSignatureVerificationResponse
private static final Logger log =
LoggerFactory.getLogger(GenericSignatureVerificationResponse.class);
-
- /** The signing time */
+ /** The signing time. */
private Date signingDateTime;
- /** The signatureCheckCode to be stored */
+ /** The signatureCheckCode to be stored. */
private int signatureCheckCode;
- /** The certificateCheckCode to be stored */
+ /** The certificateCheckCode to be stored. */
private int certificateCheckCode;
- /** The publicAuthority to be stored */
+ /** The publicAuthority to be stored. */
private boolean publicAuthority;
- /** The publicAuthorityCode to be stored */
+ /** The publicAuthorityCode to be stored. */
private String publicAuthorityCode;
- /** The qualifiedCertificate to be stored */
+ /** The qualifiedCertificate to be stored. */
private boolean qualifiedCertificate;
private byte[] x509CertificateEncoded;
@Override
public Date getSigningDateTime() {
- if (this.signingDateTime != null) {
- return new Date(this.signingDateTime.getTime());
- }
+ if (this.signingDateTime != null) {
+ return new Date(this.signingDateTime.getTime());
+ }
return null;
}
@@ -87,11 +86,11 @@ public class GenericSignatureVerificationResponse
@Override
public byte[] getX509CertificateEncoded() {
- if (this.x509CertificateEncoded != null) {
- return this.x509CertificateEncoded.clone();
-
- }
- return null;
+ if (this.x509CertificateEncoded != null) {
+ return this.x509CertificateEncoded.clone();
+
+ }
+ return null;
}
@@ -107,10 +106,15 @@ public class GenericSignatureVerificationResponse
}
+ /**
+ * Set signature creation timestramp.
+ *
+ * @param signingDateTime timestamp
+ */
public void setSigningDateTime(final Date signingDateTime) {
- if (signingDateTime != null) {
- this.signingDateTime = new Date(signingDateTime.getTime());
- }
+ if (signingDateTime != null) {
+ this.signingDateTime = new Date(signingDateTime.getTime());
+ }
}
public void setSignatureCheckCode(final int signatureCheckCode) {
@@ -133,13 +137,16 @@ public class GenericSignatureVerificationResponse
this.qualifiedCertificate = qualifiedCertificate;
}
+ /**
+ * Set encoded signer certificate.
+ *
+ * @param x509CertificateEncoded signer cerificate
+ */
public void setX509CertificateEncoded(final byte[] x509CertificateEncoded) {
- if (x509CertificateEncoded != null) {
- this.x509CertificateEncoded = x509CertificateEncoded.clone();
-
- }
- }
-
+ if (x509CertificateEncoded != null) {
+ this.x509CertificateEncoded = x509CertificateEncoded.clone();
+ }
+ }
}
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyCMSSignatureResponse.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyCmsSignatureResponse.java
index 0583a29e..ed679828 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyCMSSignatureResponse.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyCmsSignatureResponse.java
@@ -1,9 +1,9 @@
package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.data;
-import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.ICMSSignatureVerificationResponse;
+import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.ICmsSignatureVerificationResponse;
-public class VerifyCMSSignatureResponse extends GenericSignatureVerificationResponse
- implements ICMSSignatureVerificationResponse {
+public class VerifyCmsSignatureResponse extends GenericSignatureVerificationResponse
+ implements ICmsSignatureVerificationResponse {
private static final long serialVersionUID = 708260904158070696L;
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyXMLSignatureResponse.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyXMLSignatureResponse.java
deleted file mode 100644
index 003d2c46..00000000
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyXMLSignatureResponse.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.data;
-
-import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.IXMLSignatureVerificationResponse;
-
-/**
- *
- *
- * @author tlenz
- *
- */
-
-public class VerifyXMLSignatureResponse extends GenericSignatureVerificationResponse
- implements IXMLSignatureVerificationResponse {
-
- private static final long serialVersionUID = 8386070769565711601L;
-
- /** The xmlDsigSubjectName to be stored */
- private String xmlDsigSubjectName;
-
- /** The xmlDSIGManifestCheckCode to be stored */
- private int xmlDSIGManifestCheckCode;
- /** The xmlDSIGManigest to be stored */
- private boolean xmlDSIGManigest;
-
- /**
- * The result of the signature manifest check. The default value <code>-1</code> indicates that
- * the signature manifest has not been checked.
- */
- private int signatureManifestCheckCode = -1;
-
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#getXmlDSIGManifestCheckCode()
- */
- @Override
- public int getXmlDSIGManifestCheckCode() {
- return xmlDSIGManifestCheckCode;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#getXmlDsigSubjectName()
- */
- @Override
- public String getXmlDsigSubjectName() {
- return xmlDsigSubjectName;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#setXmlDSIGManifestCheckCode(
- * int)
- */
- public void setXmlDSIGManifestCheckCode(final int xmlDSIGManifestCheckCode) {
- this.xmlDSIGManifestCheckCode = xmlDSIGManifestCheckCode;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#setXmlDsigSubjectName(java.lang
- * .String)
- */
- public void setXmlDsigSubjectName(final String xmlDsigSubjectName) {
- this.xmlDsigSubjectName = xmlDsigSubjectName;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#isXmlDSIGManigest()
- */
- @Override
- public boolean isXmlDSIGManigest() {
- return xmlDSIGManigest;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#setXmlDSIGManigest(boolean)
- */
- public void setXmlDSIGManigest(final boolean xmlDSIGManigest) {
- this.xmlDSIGManigest = xmlDSIGManigest;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#getSignatureManifestCheckCode()
- */
- @Override
- public int getSignatureManifestCheckCode() {
- return signatureManifestCheckCode;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#setSignatureManifestCheckCode(
- * int)
- */
- public void setSignatureManifestCheckCode(final int signatureManifestCheckCode) {
- this.signatureManifestCheckCode = signatureManifestCheckCode;
- }
-
-}
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyXmlSignatureResponse.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyXmlSignatureResponse.java
new file mode 100644
index 00000000..4b0632b1
--- /dev/null
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/data/VerifyXmlSignatureResponse.java
@@ -0,0 +1,115 @@
+package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.data;
+
+import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.IXmlSignatureVerificationResponse;
+
+/**
+ * MOA-Sig signature verification response for XML based signatures.
+ *
+ * @author tlenz
+ *
+ */
+
+public class VerifyXmlSignatureResponse extends GenericSignatureVerificationResponse
+ implements IXmlSignatureVerificationResponse {
+
+ private static final long serialVersionUID = 8386070769565711601L;
+
+ /** The xmlDsigSubjectName to be stored. */
+ private String xmlDsigSubjectName;
+
+ /** The xmlDSIGManifestCheckCode to be stored. */
+ private int xmlDsigManifestCheckCode;
+ /** The xmlDSIGManigest to be stored. */
+ private boolean xmlDsigManigest;
+
+ /**
+ * The result of the signature manifest check. The default value <code>-1</code>
+ * indicates that the signature manifest has not been checked.
+ */
+ private int signatureManifestCheckCode = -1;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#
+ * getXmlDSIGManifestCheckCode()
+ */
+ @Override
+ public int getXmlDsigManifestCheckCode() {
+ return xmlDsigManifestCheckCode;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#
+ * getXmlDsigSubjectName()
+ */
+ @Override
+ public String getXmlDsigSubjectName() {
+ return xmlDsigSubjectName;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#
+ * setXmlDSIGManifestCheckCode( int)
+ */
+ public void setXmlDsigManifestCheckCode(final int xmlDsigManifestCheckCode) {
+ this.xmlDsigManifestCheckCode = xmlDsigManifestCheckCode;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#
+ * setXmlDsigSubjectName(java.lang .String)
+ */
+ public void setXmlDsigSubjectName(final String xmlDsigSubjectName) {
+ this.xmlDsigSubjectName = xmlDsigSubjectName;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#
+ * isXmlDSIGManigest()
+ */
+ @Override
+ public boolean isXmlDsigManigest() {
+ return xmlDsigManigest;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#
+ * setXmlDSIGManigest(boolean)
+ */
+ public void setXmlDsigManigest(final boolean xmlDsigManigest) {
+ this.xmlDsigManigest = xmlDsigManigest;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#
+ * getSignatureManifestCheckCode()
+ */
+ @Override
+ public int getSignatureManifestCheckCode() {
+ return signatureManifestCheckCode;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.auth.data.IVerifiyXMLSignatureResponse#
+ * setSignatureManifestCheckCode( int)
+ */
+ public void setSignatureManifestCheckCode(final int signatureManifestCheckCode) {
+ this.signatureManifestCheckCode = signatureManifestCheckCode;
+ }
+
+}
diff --git a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/parser/VerifyXmlSignatureResponseParser.java b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/parser/VerifyXmlSignatureResponseParser.java
index aa094f1e..231cb94f 100644
--- a/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/parser/VerifyXmlSignatureResponseParser.java
+++ b/eaaf_modules/eaaf_module_moa-sig/src/main/java/at/gv/egiz/eid/authhandler/modules/sigverify/moasig/impl/parser/VerifyXmlSignatureResponseParser.java
@@ -2,23 +2,24 @@ package at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.parser;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.IXMLSignatureVerificationResponse;
-import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceException;
-import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceParserException;
-import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.data.VerifyXMLSignatureResponse;
-import at.gv.egovernment.moaspss.util.Constants;
-import at.gv.egovernment.moaspss.util.DOMUtils;
-import at.gv.egovernment.moaspss.util.XPathUtils;
+
import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.lang.NonNull;
import org.w3c.dom.Element;
+
+import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.api.data.IXmlSignatureVerificationResponse;
+import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceException;
+import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.exceptions.MoaSigServiceParserException;
+import at.gv.egiz.eid.authhandler.modules.sigverify.moasig.impl.data.VerifyXmlSignatureResponse;
+import at.gv.egovernment.moaspss.util.Constants;
+import at.gv.egovernment.moaspss.util.DOMUtils;
+import at.gv.egovernment.moaspss.util.XPathUtils;
import iaik.utils.Base64InputStream;
import iaik.x509.X509Certificate;
-
public class VerifyXmlSignatureResponseParser {
private static final Logger log = LoggerFactory.getLogger(VerifyXmlSignatureResponseParser.class);
@@ -63,13 +64,15 @@ public class VerifyXmlSignatureResponseParser {
private static final String SIGNING_TIME_XPATH = ROOT + MOA + "SigningTime";
-
- /** This is the root element of the XML-Document provided by the Security Layer Card. */
+ /**
+ * This is the root element of the XML-Document provided by the Security Layer
+ * Card.
+ */
private Element verifyXmlSignatureResponse;
/**
- * Constructor for VerifyXMLSignatureResponseParser. A DOM-representation of the incoming String
- * will be created
+ * Constructor for VerifyXMLSignatureResponseParser. A DOM-representation of the
+ * incoming String will be created
*
* @param xmlResponse <code>&lt;InfoboxReadResponse&gt;</code> as String
* @throws MoaSigServiceParserException on any parsing error
@@ -82,14 +85,14 @@ public class VerifyXmlSignatureResponseParser {
} catch (final Throwable t) {
log.warn("Can not parse MOA-Sig response.", t);
- throw new MoaSigServiceParserException("service.moasig.02", new Object[] {t.toString()}, t);
+ throw new MoaSigServiceParserException("service.moasig.02", new Object[] { t.toString() }, t);
}
}
/**
- * Constructor for VerifyXMLSignatureResponseParser. A DOM-representation of the incoming
- * Inputstream will be created
+ * Constructor for VerifyXMLSignatureResponseParser. A DOM-representation of the
+ * incoming Inputstream will be created
*
* @param xmlResponse <code>&lt;InfoboxReadResponse&gt;</code> as InputStream
* @throws MoaSigServiceParserException on any parsing error
@@ -101,14 +104,14 @@ public class VerifyXmlSignatureResponseParser {
} catch (final Throwable t) {
log.warn("Can not parse MOA-Sig response.", t);
- throw new MoaSigServiceParserException("service.moasig.02", new Object[] {t.toString()}, t);
+ throw new MoaSigServiceParserException("service.moasig.02", new Object[] { t.toString() }, t);
}
}
/**
- * Constructor for VerifyXMLSignatureResponseParser. The incoming Element will be used for further
- * operations
+ * Constructor for VerifyXMLSignatureResponseParser. The incoming Element will
+ * be used for further operations
*
* @param xmlResponse <code>&lt;InfoboxReadResponse&gt;</code> as Element
*/
@@ -118,15 +121,16 @@ public class VerifyXmlSignatureResponseParser {
}
/**
- * Parse MOA-Sig signatur-verification result into {@link IXMLSignatureVerificationResponse}.
+ * Parse MOA-Sig signatur-verification result into
+ * {@link IXmlSignatureVerificationResponse}.
*
- * @return {@link IXMLSignatureVerificationResponse}
+ * @return {@link IXmlSignatureVerificationResponse}
* @throws MoaSigServiceException on any parsing error
*/
@NonNull
- public IXMLSignatureVerificationResponse parseData() throws MoaSigServiceException {
+ public IXmlSignatureVerificationResponse parseData() throws MoaSigServiceException {
try {
- final VerifyXMLSignatureResponse respData = new VerifyXMLSignatureResponse();
+ final VerifyXmlSignatureResponse respData = new VerifyXmlSignatureResponse();
respData.setXmlDsigSubjectName(
XPathUtils.getElementValue(verifyXmlSignatureResponse, DSIG_SUBJECT_NAME_XPATH, ""));
final Element e = (Element) XPathUtils.selectSingleNode(verifyXmlSignatureResponse,
@@ -151,11 +155,11 @@ public class VerifyXmlSignatureResponseParser {
final String xmlDsigCheckCode = XPathUtils.getElementValue(verifyXmlSignatureResponse,
XMLDSIG_MANIFEST_CHECK_CODE_XPATH, null);
if (xmlDsigCheckCode != null) {
- respData.setXmlDSIGManigest(true);
- respData.setXmlDSIGManifestCheckCode(Integer.parseInt(xmlDsigCheckCode));
+ respData.setXmlDsigManigest(true);
+ respData.setXmlDsigManifestCheckCode(Integer.parseInt(xmlDsigCheckCode));
} else {
- respData.setXmlDSIGManigest(false);
+ respData.setXmlDsigManigest(false);
}
@@ -181,10 +185,9 @@ public class VerifyXmlSignatureResponseParser {
} catch (final Throwable t) {
log.warn("Can not parse MOA-Sig response.", t);
- throw new MoaSigServiceParserException("service.moasig.02", new Object[] {t.toString()}, t);
+ throw new MoaSigServiceParserException("service.moasig.02", new Object[] { t.toString() }, t);
}
}
-
}