aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-asic/src
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2017-05-08 14:36:25 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2017-05-08 14:36:25 +0200
commit45a6390c11a307a019c8eacb2ef4c25ec6045ba3 (patch)
treed074d987733698684f6d6b0aeb7648483afa22a0 /moaSig/moa-asic/src
parentcf8769c549882f47bad496bc4ba9bd14a65429bc (diff)
downloadmoa-sig-45a6390c11a307a019c8eacb2ef4c25ec6045ba3.tar.gz
moa-sig-45a6390c11a307a019c8eacb2ef4c25ec6045ba3.tar.bz2
moa-sig-45a6390c11a307a019c8eacb2ef4c25ec6045ba3.zip
add error message to unsupported ASiC XAdES formats
Diffstat (limited to 'moaSig/moa-asic/src')
-rw-r--r--moaSig/moa-asic/src/main/java/at/gv/egiz/asic/impl/verifier/ExtendedXAdESVerifier.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/moaSig/moa-asic/src/main/java/at/gv/egiz/asic/impl/verifier/ExtendedXAdESVerifier.java b/moaSig/moa-asic/src/main/java/at/gv/egiz/asic/impl/verifier/ExtendedXAdESVerifier.java
index 58f0185..c07efd9 100644
--- a/moaSig/moa-asic/src/main/java/at/gv/egiz/asic/impl/verifier/ExtendedXAdESVerifier.java
+++ b/moaSig/moa-asic/src/main/java/at/gv/egiz/asic/impl/verifier/ExtendedXAdESVerifier.java
@@ -7,6 +7,7 @@ import at.gv.egiz.asic.api.ASiC;
import at.gv.egiz.asic.api.ASiCEntry;
import at.gv.egiz.asic.api.ASiCFormat;
import at.gv.egiz.asic.api.ASiCVerificationResult;
+import at.gv.egovernment.moa.spss.MOAApplicationException;
import at.gv.egovernment.moa.spss.MOAException;
import at.gv.egovernment.moa.spss.MOARuntimeException;
import at.gv.egovernment.moa.spss.MOASystemException;
@@ -85,6 +86,15 @@ public class ExtendedXAdESVerifier extends XAdESVerifier {
"XAdESSignatures".equals(rootElement.getLocalName())) {
XAdESSignaturesType xAdESSignaturesType = JAXB.unmarshal(xadesSignature.getContents(), XAdESSignaturesType.class);
xmlSignatures = xAdESSignaturesType.getSignature();
+
+ //TODO: maybe add additional XAdES version
+ } else if ("http://uri.etsi.org/02918/v1.1.1#".equals(rootElement.getNamespaceURI()) &&
+ "XAdESSignatures".equals(rootElement.getLocalName())) {
+
+ logger.warn("ASiC v1.1.1 is not supported any more. MOA-SP only supports v1.2.1 (http://uri.etsi.org/02918/v1.2.1#)");
+ //XAdESSignaturesType xAdESSignaturesType = JAXB.unmarshal(xadesSignature.getContents(), XAdESSignaturesType.class);
+ //xmlSignatures = xAdESSignaturesType.getSignature();
+
} else {
NodeList childrenNodes = rootElement.getChildNodes();
for(int i = 0; i < childrenNodes.getLength(); i++) {
@@ -108,6 +118,12 @@ public class ExtendedXAdESVerifier extends XAdESVerifier {
//namespaces.put("asic", "http://uri.etsi.org/02918/v1.2.1#");
namespaces.put("ds", "http://www.w3.org/2000/09/xmldsig#");
+ if (xmlSignatures == null || xmlSignatures.size() == 0) {
+ logger.info("ASiC container does not include a signature or signature format is not supported");
+ throw new MOAApplicationException("asic.0016", null);
+
+ }
+
for (int i = 0; i < xmlSignatures.size(); i++) {
//NodeList nodes = (NodeList) result;