From 45a6390c11a307a019c8eacb2ef4c25ec6045ba3 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 8 May 2017 14:36:25 +0200 Subject: add error message to unsupported ASiC XAdES formats --- .../egiz/asic/impl/verifier/ExtendedXAdESVerifier.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'moaSig/moa-asic') 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; -- cgit v1.2.3