From 6eb53981bd689212050b4de95b58ae06fd3db088 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 10 Jan 2017 15:26:33 +0100 Subject: switch canonisation implementation for some types --- .../invoke/XMLSignatureCreationProfileFactory.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'moaSig/moa-sig-lib/src') diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java index cb77ad1..32eab9e 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/invoke/XMLSignatureCreationProfileFactory.java @@ -28,6 +28,7 @@ import iaik.server.modules.algorithms.HashAlgorithms; import iaik.server.modules.keys.KeyEntryID; import iaik.server.modules.keys.KeyModule; import iaik.server.modules.keys.KeyModuleFactory; +import iaik.server.modules.xml.Canonicalization; import iaik.server.modules.xmlsign.SignatureStructureTypes; import iaik.server.modules.xmlsign.XMLSignatureCreationProfile; import iaik.server.modules.xmlsign.XMLSignatureInsertionLocation; @@ -57,6 +58,7 @@ import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider; import at.gv.egovernment.moa.spss.server.config.KeyGroup; import at.gv.egovernment.moa.spss.server.config.KeyGroupEntry; import at.gv.egovernment.moa.spss.server.iaik.xml.CanonicalizationImpl; +import at.gv.egovernment.moa.spss.server.iaik.xml.ExclusiveCanonicalizationImpl; import at.gv.egovernment.moa.spss.server.iaik.xmlsign.DataObjectTreatmentImpl; import at.gv.egovernment.moa.spss.server.iaik.xmlsign.XMLSignatureCreationProfileImpl; import at.gv.egovernment.moa.spss.server.iaik.xmlsign.XMLSignatureInsertionLocationImpl; @@ -136,7 +138,6 @@ public class XMLSignatureCreationProfileFactory { TransactionContext context = TransactionContextManager.getInstance().getTransactionContext(); ConfigurationProvider config = context.getConfiguration(); - CanonicalizationImpl canonicalization; List dataObjectTreatmentList; Set keySet; List transformationSupplements; @@ -234,9 +235,17 @@ public class XMLSignatureCreationProfileFactory { getSignatureInsertionLocationIndex(singleSignatureInfo)); // set the canonicalization algorithm - canonicalization = - new CanonicalizationImpl(config.getCanonicalizationAlgorithmName()); - profile.setSignedInfoCanonicalization(canonicalization); + String canonicalizationURI = config.getCanonicalizationAlgorithmName(); + if (Canonicalization.ALL_EXCLUSIVE.contains(canonicalizationURI)) { + ExclusiveCanonicalizationImpl canonicalization = new ExclusiveCanonicalizationImpl(config.getCanonicalizationAlgorithmName(), null); + profile.setSignedInfoCanonicalization(canonicalization); + + } else { + CanonicalizationImpl canonicalization = + new CanonicalizationImpl(config.getCanonicalizationAlgorithmName()); + profile.setSignedInfoCanonicalization(canonicalization); + + } // set the signed properties profile.setSignedProperties(Collections.EMPTY_LIST); -- cgit v1.2.3