This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch 4.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/4.1.x-fixes by this push:
new 725ee50d421 Backport fix
725ee50d421 is described below
commit 725ee50d4218131223e6392bf696f6d9a3814957
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 ++-----
.../org/apache/cxf/rs/security/xml/XmlSecInInterceptorTest.java | 7 +------
2 files changed, 3 insertions(+), 11 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 2388a1ba1f0..de56f2565cc 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 jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ReaderInterceptor;
import jakarta.ws.rs.ext.ReaderInterceptorContext;
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/XmlSecInInterceptorTest.java
b/rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptorTest.java
index a48209bdef6..f44ffbb9e16 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 jakarta.ws.rs.WebApplicationException;
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);