This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch 3.6.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 9ef9bead44ec2b9ea0cc7287108eae0740b0548a Author: Colm O hEigeartaigh <[email protected]> AuthorDate: Tue Nov 24 13:34:08 2026 +0000 Backport fix --- .../java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java | 7 ++----- .../java/org/apache/cxf/rs/security/xml/XmlEncInHandlerTest.java | 2 +- .../org/apache/cxf/rs/security/xml/XmlSecInInterceptorTest.java | 7 +------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java index 2d2fb08d2e1..110dbd0a320 100644 --- a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java +++ b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java @@ -44,7 +44,6 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.helpers.JavaUtils; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.interceptor.StaxInInterceptor; import org.apache.cxf.jaxrs.impl.ReaderInterceptorContextImpl; @@ -312,13 +311,11 @@ public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message> imple } } - // RSA-OAEP is the required default Key Transport Algorithm (RSA-OAEP-11 in FIPS mode), - // as in AbstractXmlEncInHandler + // RSA-OAEP is the required default Key Transport Algorithm, as in AbstractXmlEncInHandler private static void checkDefaultKeyTransportAlgorithm(AlgorithmSuiteSecurityEvent event) throws XMLSecurityException { - String defaultAlgorithm = JavaUtils.isFIPSEnabled() ? XMLCipher.RSA_OAEP_11 : XMLCipher.RSA_OAEP; if (XMLSecurityConstants.Asym_Key_Wrap.equals(event.getAlgorithmUsage()) - && !defaultAlgorithm.equals(event.getAlgorithmURI())) { + && !XMLCipher.RSA_OAEP.equals(event.getAlgorithmURI())) { throw new XMLSecurityException("empty", new Object[] {"The key transport algorithm " + event.getAlgorithmURI() + " is not allowed"}); } diff --git a/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/xml/XmlEncInHandlerTest.java b/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/xml/XmlEncInHandlerTest.java index a3c89bd19ab..1f8255b75d9 100644 --- a/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/xml/XmlEncInHandlerTest.java +++ b/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/xml/XmlEncInHandlerTest.java @@ -30,7 +30,7 @@ import javax.xml.stream.XMLStreamReader; import org.w3c.dom.Document; import org.w3c.dom.Element; -import jakarta.ws.rs.WebApplicationException; +import javax.ws.rs.WebApplicationException; import org.apache.cxf.helpers.DOMUtils; import org.apache.cxf.message.ExchangeImpl; import org.apache.cxf.message.Message; diff --git a/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptorTest.java b/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptorTest.java index 7489a66fd4c..41d41ebce01 100644 --- a/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptorTest.java +++ b/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptorTest.java @@ -39,7 +39,6 @@ import org.w3c.dom.Element; import org.apache.cxf.bus.managers.PhaseManagerImpl; import org.apache.cxf.helpers.DOMUtils; -import org.apache.cxf.helpers.JavaUtils; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.message.ExchangeImpl; import org.apache.cxf.message.Message; @@ -60,7 +59,6 @@ import org.apache.xml.security.signature.XMLSignature; import org.apache.xml.security.transforms.Transforms; import org.apache.xml.security.utils.Constants; -import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; @@ -153,8 +151,7 @@ public class XmlSecInInterceptorTest { @Test public void testDefaultKeyTransportAlgorithm() throws Exception { - String defaultAlgorithm = JavaUtils.isFIPSEnabled() ? XMLCipher.RSA_OAEP_11 : XMLCipher.RSA_OAEP; - Element root = processEncrypted(createEncryptedDocument(defaultAlgorithm), null); + Element root = processEncrypted(createEncryptedDocument(XMLCipher.RSA_OAEP), null); assertEquals("Book", root.getLocalName()); assertEquals("CXF", DOMUtils.getFirstElement(root).getTextContent()); @@ -162,7 +159,6 @@ public class XmlSecInInterceptorTest { @Test public void testNonDefaultKeyTransportAlgorithmIsRejected() throws Exception { - Assume.assumeFalse(JavaUtils.isFIPSEnabled()); try { processEncrypted(createEncryptedDocument(XMLCipher.RSA_OAEP_11), null); fail("Failure expected on a non-default key transport algorithm"); @@ -173,7 +169,6 @@ public class XmlSecInInterceptorTest { @Test public void testConfiguredKeyTransportAlgorithm() throws Exception { - Assume.assumeFalse(JavaUtils.isFIPSEnabled()); EncryptionProperties encProps = new EncryptionProperties(); encProps.setEncryptionKeyTransportAlgo(XMLCipher.RSA_OAEP_11); Element root = processEncrypted(createEncryptedDocument(XMLCipher.RSA_OAEP_11), encProps);
