diff options
-rw-r--r-- | moaSig/moa-asic/src/main/java/at/gv/egiz/asic/impl/verifier/ExtendedXAdESVerifier.java | 16 |
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; |