From 675881cd85e0beeee8bf85da42df0953328da7b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20=C5=81askawiec?= Date: Fri, 2 Oct 2026 13:02:12 +0200 Subject: [PATCH] Add Brisbane FIPS provider PoC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sebastian Ɓaskawiec --- .../java/org/keycloak/common/Profile.java | 2 + .../common/crypto/CryptoIntegration.java | 32 ++- .../common/crypto/CryptoProviderFactory.java | 25 ++ .../keycloak/common/crypto/FipsProvider.java | 34 +++ .../java/org/keycloak/common/ProfileTest.java | 15 ++ .../crypto/CryptoProviderFactoryTest.java | 96 ++++++++ .../common/crypto/FipsProviderTest.java | 38 +++ crypto/brisbane/pom.xml | 59 +++++ .../brisbane/BrisbaneCryptoProvider.java | 154 ++++++++++++ .../BrisbaneCryptoProviderFactory.java | 40 ++++ .../BrisbaneStrictCryptoProvider.java | 30 +++ ...ycloak.common.crypto.CryptoProviderFactory | 1 + .../brisbane/BrisbaneCryptoProviderTest.java | 77 ++++++ .../def/DefaultCryptoProviderFactory.java | 38 +++ ...ycloak.common.crypto.CryptoProviderFactory | 18 ++ .../elytron/AesKeyWrapAlgorithmProvider.java | 13 +- .../ElytronEcdhEsAlgorithmProvider.java | 13 +- ...nRsaKeyEncryptionJWEAlgorithmProvider.java | 2 +- .../elytron/WildFlyElytronProvider.java | 9 + .../elytron/WildFlyElytronProviderTest.java | 50 ++++ .../elytron/test/ElytronCryptoJWETest.java | 7 - .../crypto/fips/Fips1402ProviderFactory.java | 40 ++++ ...ycloak.common.crypto.CryptoProviderFactory | 18 ++ crypto/pom.xml | 3 +- docs/brisbane-poc.md | 222 ++++++++++++++++++ .../release_notes/topics/26_8_0.adoc | 5 +- .../topics/changes/changes-26_8_1.adoc | 4 + docs/guides/server/fips.adoc | 26 +- pom.xml | 18 ++ .../java/org/keycloak/config/HttpOptions.java | 4 +- quarkus/container/Dockerfile.brisbane | 49 ++++ .../quarkus/deployment/KeycloakProcessor.java | 7 +- quarkus/runtime/pom.xml | 14 ++ .../quarkus/runtime/KeycloakRecorder.java | 27 ++- .../configuration/IgnoredArtifacts.java | 24 +- .../mappers/HttpPropertyMappers.java | 15 +- .../quarkus/runtime/cli/PicocliTest.java | 16 ++ .../configuration/IgnoredArtifactsTest.java | 21 +- .../ManagementConfigurationTest.java | 21 +- quarkus/server/pom.xml | 10 + ...mandDistTest.testStartDevHelp.approved.txt | 10 +- ...dDistTest.testStartDevHelpAll.approved.txt | 10 +- ...CommandDistTest.testStartHelp.approved.txt | 10 +- ...mandDistTest.testStartHelpAll.approved.txt | 10 +- ...stTest.testStartOptimizedHelp.approved.txt | 10 +- ...est.testStartOptimizedHelpAll.approved.txt | 10 +- ...tUpdateCompatibilityCheckHelp.approved.txt | 10 +- ...dateCompatibilityCheckHelpAll.approved.txt | 10 +- ...dateCompatibilityMetadataHelp.approved.txt | 10 +- ...eCompatibilityMetadataHelpAll.approved.txt | 10 +- 50 files changed, 1297 insertions(+), 100 deletions(-) create mode 100644 common/src/main/java/org/keycloak/common/crypto/CryptoProviderFactory.java create mode 100644 common/src/main/java/org/keycloak/common/crypto/FipsProvider.java create mode 100644 common/src/test/java/org/keycloak/common/crypto/CryptoProviderFactoryTest.java create mode 100644 common/src/test/java/org/keycloak/common/crypto/FipsProviderTest.java create mode 100644 crypto/brisbane/pom.xml create mode 100644 crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProvider.java create mode 100644 crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProviderFactory.java create mode 100644 crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneStrictCryptoProvider.java create mode 100644 crypto/brisbane/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory create mode 100644 crypto/brisbane/src/test/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProviderTest.java create mode 100644 crypto/default/src/main/java/org/keycloak/crypto/def/DefaultCryptoProviderFactory.java create mode 100644 crypto/default/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory create mode 100644 crypto/elytron/src/test/java/org/keycloak/crypto/elytron/WildFlyElytronProviderTest.java create mode 100644 crypto/fips1402/src/main/java/org/keycloak/crypto/fips/Fips1402ProviderFactory.java create mode 100644 crypto/fips1402/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory create mode 100644 docs/brisbane-poc.md create mode 100644 quarkus/container/Dockerfile.brisbane diff --git a/common/src/main/java/org/keycloak/common/Profile.java b/common/src/main/java/org/keycloak/common/Profile.java index 02d60d6a78bb..51fb3dbcfcf5 100755 --- a/common/src/main/java/org/keycloak/common/Profile.java +++ b/common/src/main/java/org/keycloak/common/Profile.java @@ -124,6 +124,8 @@ public enum Feature { FIPS("FIPS 140-2 mode", Type.DISABLED_BY_DEFAULT), + BRISBANE("Brisbane cryptographic provider", Type.EXPERIMENTAL, Feature.FIPS), + DPOP("OAuth 2.0 Demonstrating Proof-of-Possession at the Application Layer", Type.DEFAULT), DEVICE_FLOW("OAuth 2.0 Device Authorization Grant", Type.DEFAULT), diff --git a/common/src/main/java/org/keycloak/common/crypto/CryptoIntegration.java b/common/src/main/java/org/keycloak/common/crypto/CryptoIntegration.java index 8e7457bebdb0..611ed1f3040c 100644 --- a/common/src/main/java/org/keycloak/common/crypto/CryptoIntegration.java +++ b/common/src/main/java/org/keycloak/common/crypto/CryptoIntegration.java @@ -6,6 +6,7 @@ import java.util.Comparator; import java.util.List; import java.util.ServiceLoader; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; @@ -27,10 +28,18 @@ public class CryptoIntegration { private static volatile CryptoProvider cryptoProvider; public static void init(ClassLoader classLoader) { + init(() -> detectProvider(classLoader)); + } + + public static void init(ClassLoader classLoader, String providerName, FipsMode fipsMode) { + init(() -> detectProvider(classLoader, providerName, fipsMode)); + } + + private static void init(Supplier providerSupplier) { if (cryptoProvider == null) { synchronized (lock) { if (cryptoProvider == null) { - cryptoProvider = detectProvider(classLoader); + cryptoProvider = providerSupplier.get(); logger.debugv("java security provider: {0}", BouncyIntegration.PROVIDER); } @@ -43,6 +52,27 @@ public static void init(ClassLoader classLoader) { } } + static CryptoProvider detectProvider(Iterable factories, String providerName, FipsMode fipsMode) { + List matchingFactories = StreamSupport.stream(factories.spliterator(), false) + .filter(factory -> providerName.equals(factory.getName())) + .collect(Collectors.toList()); + + if (matchingFactories.size() != 1) { + throw new IllegalStateException("Expected one crypto provider named '" + providerName + "', found " + matchingFactories.size()); + } + + CryptoProvider provider = matchingFactories.get(0).create(fipsMode); + if (provider == null) { + throw new IllegalStateException("Crypto provider factory '" + providerName + "' returned null"); + } + logger.debugf("Detected crypto provider: %s", provider.getClass().getName()); + return provider; + } + + private static CryptoProvider detectProvider(ClassLoader classLoader, String providerName, FipsMode fipsMode) { + return detectProvider(ServiceLoader.load(CryptoProviderFactory.class, classLoader), providerName, fipsMode); + } + public static boolean isInitialised() { return cryptoProvider != null; } diff --git a/common/src/main/java/org/keycloak/common/crypto/CryptoProviderFactory.java b/common/src/main/java/org/keycloak/common/crypto/CryptoProviderFactory.java new file mode 100644 index 000000000000..ca4f65b8f7e7 --- /dev/null +++ b/common/src/main/java/org/keycloak/common/crypto/CryptoProviderFactory.java @@ -0,0 +1,25 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.common.crypto; + +public interface CryptoProviderFactory { + + String getName(); + + CryptoProvider create(FipsMode fipsMode); +} diff --git a/common/src/main/java/org/keycloak/common/crypto/FipsProvider.java b/common/src/main/java/org/keycloak/common/crypto/FipsProvider.java new file mode 100644 index 000000000000..ff9819731580 --- /dev/null +++ b/common/src/main/java/org/keycloak/common/crypto/FipsProvider.java @@ -0,0 +1,34 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.common.crypto; + +public enum FipsProvider { + BOUNCY_CASTLE("bouncycastle"), + BRISBANE("brisbane"); + + private final String optionName; + + FipsProvider(String optionName) { + this.optionName = optionName; + } + + @Override + public String toString() { + return optionName; + } +} diff --git a/common/src/test/java/org/keycloak/common/ProfileTest.java b/common/src/test/java/org/keycloak/common/ProfileTest.java index 12283291d8fd..a3fb76c7d270 100644 --- a/common/src/test/java/org/keycloak/common/ProfileTest.java +++ b/common/src/test/java/org/keycloak/common/ProfileTest.java @@ -102,6 +102,21 @@ public void checkFailureIfDependencyDisabled() { () -> Profile.configure(new PropertiesProfileConfigResolver(properties))).getMessage()); } + @Test + public void brisbaneRequiresFipsFeature() { + Properties properties = new Properties(); + properties.setProperty("keycloak.profile.feature.brisbane", "enabled"); + + Assertions.assertEquals("Feature brisbane depends on disabled feature fips", + assertThrows(ProfileException.class, + () -> Profile.configure(new PropertiesProfileConfigResolver(properties))).getMessage()); + + properties.setProperty("keycloak.profile.feature.fips", "enabled"); + Profile.configure(new PropertiesProfileConfigResolver(properties)); + Assertions.assertTrue(Profile.isFeatureEnabled(Profile.Feature.BRISBANE)); + Assertions.assertTrue(Profile.isFeatureEnabled(Profile.Feature.FIPS)); + } + @Test public void checkSuccessIfFeatureDisabledWithDisabledDependencies() { Properties properties = new Properties(); diff --git a/common/src/test/java/org/keycloak/common/crypto/CryptoProviderFactoryTest.java b/common/src/test/java/org/keycloak/common/crypto/CryptoProviderFactoryTest.java new file mode 100644 index 000000000000..a1f4ff882fb6 --- /dev/null +++ b/common/src/test/java/org/keycloak/common/crypto/CryptoProviderFactoryTest.java @@ -0,0 +1,96 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.common.crypto; + +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.atomic.AtomicReference; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class CryptoProviderFactoryTest { + + @Test + public void shouldSelectFactoryByNameAndPassFipsMode() { + CryptoProvider expected = provider(); + AtomicReference selectedMode = new AtomicReference<>(); + List factories = Arrays.asList( + factory("default", provider(), new AtomicReference<>()), + factory("brisbane", expected, selectedMode)); + + CryptoProvider actual = CryptoIntegration.detectProvider(factories, "brisbane", FipsMode.STRICT); + + assertSame(expected, actual); + assertEquals(FipsMode.STRICT, selectedMode.get()); + } + + @Test + public void shouldRejectMissingFactory() { + IllegalStateException cause = assertThrows(IllegalStateException.class, + () -> CryptoIntegration.detectProvider(Collections.emptyList(), "brisbane", FipsMode.STRICT)); + + assertEquals("Expected one crypto provider named 'brisbane', found 0", cause.getMessage()); + } + + @Test + public void shouldRejectDuplicateFactories() { + List factories = Arrays.asList( + factory("brisbane", provider(), new AtomicReference<>()), + factory("brisbane", provider(), new AtomicReference<>())); + + IllegalStateException cause = assertThrows(IllegalStateException.class, + () -> CryptoIntegration.detectProvider(factories, "brisbane", FipsMode.STRICT)); + + assertEquals("Expected one crypto provider named 'brisbane', found 2", cause.getMessage()); + } + + @Test + public void shouldRejectNullProvider() { + IllegalStateException cause = assertThrows(IllegalStateException.class, + () -> CryptoIntegration.detectProvider( + Collections.singletonList(factory("brisbane", null, new AtomicReference<>())), "brisbane", FipsMode.STRICT)); + + assertEquals("Crypto provider factory 'brisbane' returned null", cause.getMessage()); + } + + private static CryptoProviderFactory factory(String name, CryptoProvider provider, AtomicReference selectedMode) { + return new CryptoProviderFactory() { + @Override + public String getName() { + return name; + } + + @Override + public CryptoProvider create(FipsMode fipsMode) { + selectedMode.set(fipsMode); + return provider; + } + }; + } + + private static CryptoProvider provider() { + return (CryptoProvider) Proxy.newProxyInstance(CryptoProvider.class.getClassLoader(), + new Class[] { CryptoProvider.class }, (proxy, method, args) -> null); + } +} diff --git a/common/src/test/java/org/keycloak/common/crypto/FipsProviderTest.java b/common/src/test/java/org/keycloak/common/crypto/FipsProviderTest.java new file mode 100644 index 000000000000..b9ceedbbd75b --- /dev/null +++ b/common/src/test/java/org/keycloak/common/crypto/FipsProviderTest.java @@ -0,0 +1,38 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.common.crypto; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class FipsProviderTest { + + @Test + public void shouldUseProviderFactoryNames() { + assertEquals("bouncycastle", FipsProvider.BOUNCY_CASTLE.toString()); + assertEquals("brisbane", FipsProvider.BRISBANE.toString()); + } + + @Test + public void shouldKeepExistingProviderClassNames() { + assertEquals("org.keycloak.crypto.fips.FIPS1402Provider", FipsMode.NON_STRICT.getProviderClassName()); + assertEquals("org.keycloak.crypto.fips.Fips1402StrictCryptoProvider", FipsMode.STRICT.getProviderClassName()); + assertEquals("org.keycloak.crypto.def.DefaultCryptoProvider", FipsMode.DISABLED.getProviderClassName()); + } +} diff --git a/crypto/brisbane/pom.xml b/crypto/brisbane/pom.xml new file mode 100644 index 000000000000..e6b9cf7ab1f7 --- /dev/null +++ b/crypto/brisbane/pom.xml @@ -0,0 +1,59 @@ + + + + + + keycloak-crypto-parent + org.keycloak + 999.0.0-SNAPSHOT + ../pom.xml + + 4.0.0 + + keycloak-crypto-brisbane + Keycloak Crypto Brisbane Integration + Keycloak Crypto Brisbane Integration + + + + org.keycloak + keycloak-crypto-elytron + + + com.github.slaskawi + brisbane + + + org.jboss.logging + jboss-logging + provided + + + junit + junit + test + + + org.hamcrest + hamcrest + test + + + + diff --git a/crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProvider.java b/crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProvider.java new file mode 100644 index 000000000000..0e3ffd4a885c --- /dev/null +++ b/crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProvider.java @@ -0,0 +1,154 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.crypto.brisbane; + +import java.lang.reflect.InvocationTargetException; +import java.security.AlgorithmParameters; +import java.security.KeyFactory; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.security.Security; +import java.security.Signature; +import java.security.spec.ECGenParameterSpec; +import java.security.spec.ECParameterSpec; +import javax.crypto.Cipher; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKeyFactory; + +import org.keycloak.common.crypto.CryptoConstants; +import org.keycloak.crypto.JavaAlgorithm; +import org.keycloak.crypto.elytron.WildFlyElytronProvider; + +import org.jboss.logging.Logger; + +public class BrisbaneCryptoProvider extends WildFlyElytronProvider { + + private static final Logger LOG = Logger.getLogger(BrisbaneCryptoProvider.class); + private static final String PROVIDER_CLASS = "com.oracle.jipher.provider.JipherJCE"; + private static final String PROVIDER_NAME = "JipherJCE"; + private static final String FIPS_ENFORCEMENT = "jipher.fips.enforcement"; + + private final Provider jipherProvider; + + public BrisbaneCryptoProvider() { + this(false); + } + + protected BrisbaneCryptoProvider(boolean strict) { + this(resolveProvider(strict), strict); + } + + BrisbaneCryptoProvider(Provider provider, boolean strict) { + jipherProvider = provider; + boolean inserted = Security.getProvider(PROVIDER_NAME) == null; + if (inserted) { + Security.insertProviderAt(jipherProvider, 1); + } + try { + if (strict && Security.getProviders()[0] != jipherProvider) { + throw new IllegalStateException("Brisbane must be the highest priority security provider in strict mode"); + } + LOG.infof("BrisbaneCryptoProvider created: KC(%s, FIPS policy: %s)", jipherProvider, + System.getProperty(FIPS_ENFORCEMENT, "FIPS")); + } catch (RuntimeException cause) { + if (inserted) { + Security.removeProvider(PROVIDER_NAME); + } + throw cause; + } + } + + private static Provider resolveProvider(boolean strict) { + String requiredPolicy = strict ? "FIPS_STRICT" : "FIPS"; + String currentPolicy = System.getProperty(FIPS_ENFORCEMENT); + if (currentPolicy != null && !requiredPolicy.equals(currentPolicy)) { + throw new IllegalStateException("Brisbane requires " + FIPS_ENFORCEMENT + "=" + requiredPolicy); + } + if (Security.getProvider(PROVIDER_NAME) != null) { + throw new IllegalStateException("Brisbane must be configured before Jipher is registered"); + } + System.setProperty(FIPS_ENFORCEMENT, requiredPolicy); + try { + Object provider = Class.forName(PROVIDER_CLASS, true, Thread.currentThread().getContextClassLoader()) + .getDeclaredConstructor().newInstance(); + if (provider instanceof Provider securityProvider) { + return securityProvider; + } + throw new IllegalStateException(PROVIDER_CLASS + " is not a Java security provider"); + } catch (InvocationTargetException cause) { + throw new IllegalStateException("Failed to initialize Brisbane", cause.getCause()); + } catch (ReflectiveOperationException | LinkageError cause) { + throw new IllegalStateException("Brisbane 20.1 and Java 25 or later are required", cause); + } + } + + @Override + public Provider getBouncyCastleProvider() { + return jipherProvider; + } + + @Override + public T getAlgorithmProvider(Class clazz, String algorithm) { + if (CryptoConstants.RSA1_5.equals(algorithm)) { + throw new IllegalArgumentException("RSA1_5 key transport is not supported by Brisbane"); + } + return super.getAlgorithmProvider(clazz, algorithm); + } + + @Override + public ECParameterSpec createECParams(String curveName) { + try { + AlgorithmParameters parameters = AlgorithmParameters.getInstance("EC", jipherProvider); + parameters.init(new ECGenParameterSpec(curveName)); + return parameters.getParameterSpec(ECParameterSpec.class); + } catch (Exception cause) { + throw new RuntimeException("Failed to generate EC parameter spec", cause); + } + } + + @Override + public KeyPairGenerator getKeyPairGen(String algorithm) throws NoSuchAlgorithmException { + return KeyPairGenerator.getInstance("ECDSA".equals(algorithm) ? "EC" : algorithm, jipherProvider); + } + + @Override + public KeyFactory getKeyFactory(String algorithm) throws NoSuchAlgorithmException { + return KeyFactory.getInstance("ECDSA".equals(algorithm) ? "EC" : algorithm, jipherProvider); + } + + @Override + public Cipher getAesCbcCipher() throws NoSuchAlgorithmException, NoSuchPaddingException { + return Cipher.getInstance("AES/CBC/PKCS5Padding", jipherProvider); + } + + @Override + public Cipher getAesGcmCipher() throws NoSuchAlgorithmException, NoSuchPaddingException { + return Cipher.getInstance("AES/GCM/NoPadding", jipherProvider); + } + + @Override + public SecretKeyFactory getSecretKeyFact(String keyAlgorithm) throws NoSuchAlgorithmException { + return SecretKeyFactory.getInstance(keyAlgorithm, jipherProvider); + } + + @Override + public Signature getSignature(String sigAlgName) throws NoSuchAlgorithmException { + return Signature.getInstance(JavaAlgorithm.getJavaAlgorithm(sigAlgName), jipherProvider); + } +} diff --git a/crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProviderFactory.java b/crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProviderFactory.java new file mode 100644 index 000000000000..499104317a1b --- /dev/null +++ b/crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProviderFactory.java @@ -0,0 +1,40 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.crypto.brisbane; + +import org.keycloak.common.crypto.CryptoProvider; +import org.keycloak.common.crypto.CryptoProviderFactory; +import org.keycloak.common.crypto.FipsMode; +import org.keycloak.common.crypto.FipsProvider; + +public class BrisbaneCryptoProviderFactory implements CryptoProviderFactory { + + @Override + public String getName() { + return FipsProvider.BRISBANE.toString(); + } + + @Override + public CryptoProvider create(FipsMode fipsMode) { + return switch (fipsMode) { + case NON_STRICT -> new BrisbaneCryptoProvider(); + case STRICT -> new BrisbaneStrictCryptoProvider(); + case DISABLED -> throw new IllegalArgumentException("The Brisbane provider requires FIPS mode"); + }; + } +} diff --git a/crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneStrictCryptoProvider.java b/crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneStrictCryptoProvider.java new file mode 100644 index 000000000000..28d7c470ee3e --- /dev/null +++ b/crypto/brisbane/src/main/java/org/keycloak/crypto/brisbane/BrisbaneStrictCryptoProvider.java @@ -0,0 +1,30 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.crypto.brisbane; + +public class BrisbaneStrictCryptoProvider extends BrisbaneCryptoProvider { + + public BrisbaneStrictCryptoProvider() { + super(true); + } + + @Override + public String[] getSupportedRsaKeySizes() { + return new String[] { "2048", "3072", "4096" }; + } +} diff --git a/crypto/brisbane/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory b/crypto/brisbane/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory new file mode 100644 index 000000000000..f31ab3ab54ab --- /dev/null +++ b/crypto/brisbane/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory @@ -0,0 +1 @@ +org.keycloak.crypto.brisbane.BrisbaneCryptoProviderFactory diff --git a/crypto/brisbane/src/test/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProviderTest.java b/crypto/brisbane/src/test/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProviderTest.java new file mode 100644 index 000000000000..a186d62c9688 --- /dev/null +++ b/crypto/brisbane/src/test/java/org/keycloak/crypto/brisbane/BrisbaneCryptoProviderTest.java @@ -0,0 +1,77 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.crypto.brisbane; + +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.security.Security; + +import org.keycloak.common.crypto.CryptoConstants; +import org.keycloak.jose.jwe.alg.JWEAlgorithmProvider; + +import org.junit.After; +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThrows; + +public class BrisbaneCryptoProviderTest { + + @After + public void cleanup() { + Security.removeProvider("JipherJCE"); + } + + @Test + public void shouldRegisterJipherAtHighestPriority() { + Provider jipher = new Provider("JipherJCE", "test", "Test Jipher provider") { + }; + + BrisbaneCryptoProvider provider = new BrisbaneCryptoProvider(jipher, true); + + assertThat(provider.getBouncyCastleProvider(), is(jipher)); + assertThat(Security.getProviders()[0], is(jipher)); + assertThrows(NoSuchAlgorithmException.class, provider::getAesCbcCipher); + assertThrows(IllegalArgumentException.class, + () -> provider.getAlgorithmProvider(JWEAlgorithmProvider.class, CryptoConstants.RSA1_5)); + } + + @Test + public void shouldUseSuppliedProviderForAesCbc() throws Exception { + // given + Provider supplied = new Provider("JipherJCE", "test", "Test provider") { + }; + supplied.putAll(Security.getProvider("SunJCE")); + BrisbaneCryptoProvider provider = new BrisbaneCryptoProvider(supplied, false); + Security.removeProvider("JipherJCE"); + + // then + assertThat(provider.getAesCbcCipher().getProvider(), is(supplied)); + } + + @Test + public void shouldRejectPreviouslyRegisteredJipher() { + Security.addProvider(new Provider("JipherJCE", "test", "Test Jipher provider") { + }); + + IllegalStateException cause = assertThrows(IllegalStateException.class, BrisbaneCryptoProvider::new); + + assertThat(cause.getMessage(), is("Brisbane must be configured before Jipher is registered")); + } +} diff --git a/crypto/default/src/main/java/org/keycloak/crypto/def/DefaultCryptoProviderFactory.java b/crypto/default/src/main/java/org/keycloak/crypto/def/DefaultCryptoProviderFactory.java new file mode 100644 index 000000000000..c614b031e912 --- /dev/null +++ b/crypto/default/src/main/java/org/keycloak/crypto/def/DefaultCryptoProviderFactory.java @@ -0,0 +1,38 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.crypto.def; + +import org.keycloak.common.crypto.CryptoProvider; +import org.keycloak.common.crypto.CryptoProviderFactory; +import org.keycloak.common.crypto.FipsMode; + +public class DefaultCryptoProviderFactory implements CryptoProviderFactory { + + @Override + public String getName() { + return "default"; + } + + @Override + public CryptoProvider create(FipsMode fipsMode) { + if (fipsMode.isFipsEnabled()) { + throw new IllegalArgumentException("The default crypto provider does not support FIPS mode"); + } + return new DefaultCryptoProvider(); + } +} diff --git a/crypto/default/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory b/crypto/default/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory new file mode 100644 index 000000000000..e52358ef1f0f --- /dev/null +++ b/crypto/default/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory @@ -0,0 +1,18 @@ +# +# Copyright 2026 Red Hat, Inc. and/or its affiliates +# and other contributors as indicated by the @author tags. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +org.keycloak.crypto.def.DefaultCryptoProviderFactory diff --git a/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/AesKeyWrapAlgorithmProvider.java b/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/AesKeyWrapAlgorithmProvider.java index 513176cff0e1..e76d9d9102dd 100644 --- a/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/AesKeyWrapAlgorithmProvider.java +++ b/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/AesKeyWrapAlgorithmProvider.java @@ -22,7 +22,6 @@ import org.keycloak.jose.jwe.JWEHeader; import org.keycloak.jose.jwe.JWEHeader.JWEHeaderBuilder; import org.keycloak.jose.jwe.JWEKeyStorage; -import org.keycloak.jose.jwe.JWEKeyStorage.KeyUse; import org.keycloak.jose.jwe.alg.JWEAlgorithmProvider; import org.keycloak.jose.jwe.enc.JWEEncryptionProvider; @@ -33,16 +32,16 @@ public class AesKeyWrapAlgorithmProvider implements JWEAlgorithmProvider { @Override public byte[] decodeCek(byte[] encodedCek, Key encryptionKey, JWEHeader header, JWEEncryptionProvider encryptionProvider) throws Exception { - Cipher cipher = Cipher.getInstance("AESWrap_128"); - cipher.init(Cipher.UNWRAP_MODE, encryptionKey); - return cipher.unwrap(encodedCek, "AES", Cipher.SECRET_KEY).getEncoded(); + Cipher cipher = WildFlyElytronProvider.getCipher("AESWrap_128"); + cipher.init(Cipher.DECRYPT_MODE, encryptionKey); + return cipher.doFinal(encodedCek); } @Override public byte[] encodeCek(JWEEncryptionProvider encryptionProvider, JWEKeyStorage keyStorage, Key encryptionKey, JWEHeaderBuilder headerBuilder) throws Exception { - Cipher cipher = Cipher.getInstance("AESWrap_128"); - cipher.init(Cipher.WRAP_MODE, encryptionKey); - return cipher.wrap(keyStorage.getCEKKey(KeyUse.ENCRYPTION, false)); + Cipher cipher = WildFlyElytronProvider.getCipher("AESWrap_128"); + cipher.init(Cipher.ENCRYPT_MODE, encryptionKey); + return cipher.doFinal(keyStorage.getCekBytes()); } diff --git a/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/ElytronEcdhEsAlgorithmProvider.java b/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/ElytronEcdhEsAlgorithmProvider.java index 960760a675e1..2b7050c35491 100644 --- a/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/ElytronEcdhEsAlgorithmProvider.java +++ b/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/ElytronEcdhEsAlgorithmProvider.java @@ -76,9 +76,9 @@ public byte[] decodeCek(byte[] encodedCek, Key encryptionKey, JWEHeader header, if (Algorithm.ECDH_ES.equals(header.getAlgorithm())) { return derivedKey; } else { - Cipher cipher = Cipher.getInstance(getAesWrapAlgorithm(header.getAlgorithm())); - cipher.init(Cipher.UNWRAP_MODE, new SecretKeySpec(derivedKey, "AES")); - return cipher.unwrap(encodedCek, "AES", Cipher.SECRET_KEY).getEncoded(); + Cipher cipher = WildFlyElytronProvider.getCipher(getAesWrapAlgorithm(header.getAlgorithm())); + cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(derivedKey, "AES")); + return cipher.doFinal(encodedCek); } } @@ -109,10 +109,9 @@ public byte[] encodeCek(JWEEncryptionProvider encryptionProvider, JWEKeyStorage encryptionProvider.deserializeCEK(keyStorage); return new byte[0]; } else { - Cipher cipher = Cipher.getInstance(getAesWrapAlgorithm(header.getAlgorithm())); - cipher.init(Cipher.WRAP_MODE, new SecretKeySpec(derivedKey, "AES")); - byte[] cekBytes = keyStorage.getCekBytes(); - return cipher.wrap(new SecretKeySpec(cekBytes, "AES")); + Cipher cipher = WildFlyElytronProvider.getCipher(getAesWrapAlgorithm(header.getAlgorithm())); + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(derivedKey, "AES")); + return cipher.doFinal(keyStorage.getCekBytes()); } } diff --git a/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/ElytronRsaKeyEncryptionJWEAlgorithmProvider.java b/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/ElytronRsaKeyEncryptionJWEAlgorithmProvider.java index 7833fb399db3..e63727fb1382 100644 --- a/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/ElytronRsaKeyEncryptionJWEAlgorithmProvider.java +++ b/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/ElytronRsaKeyEncryptionJWEAlgorithmProvider.java @@ -52,7 +52,7 @@ public byte[] encodeCek(JWEEncryptionProvider encryptionProvider, JWEKeyStorage } private Cipher getCipherProvider() throws Exception { - return Cipher.getInstance(jcaAlgorithmName); + return WildFlyElytronProvider.getCipher(jcaAlgorithmName); } protected void initCipher(Cipher cipher, int mode, Key key) throws Exception { diff --git a/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/WildFlyElytronProvider.java b/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/WildFlyElytronProvider.java index 61f41318aebf..05b033b3eb03 100644 --- a/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/WildFlyElytronProvider.java +++ b/crypto/elytron/src/main/java/org/keycloak/crypto/elytron/WildFlyElytronProvider.java @@ -44,6 +44,7 @@ import org.keycloak.common.crypto.CertificateUtilsProvider; import org.keycloak.common.crypto.CryptoConstants; +import org.keycloak.common.crypto.CryptoIntegration; import org.keycloak.common.crypto.CryptoProvider; import org.keycloak.common.crypto.ECDSACryptoProvider; import org.keycloak.common.crypto.PemUtilsProvider; @@ -54,10 +55,18 @@ public class WildFlyElytronProvider implements CryptoProvider { + static Cipher getCipher(String transformation) throws NoSuchAlgorithmException, NoSuchPaddingException { + CryptoProvider cryptoProvider = CryptoIntegration.isInitialised() ? CryptoIntegration.getProvider() : null; + Provider provider = cryptoProvider instanceof WildFlyElytronProvider ? cryptoProvider.getBouncyCastleProvider() : null; + return provider == null ? Cipher.getInstance(transformation) : Cipher.getInstance(transformation, provider); + } + private Map providers = new ConcurrentHashMap<>(); public WildFlyElytronProvider() { providers.put(CryptoConstants.A128KW, new AesKeyWrapAlgorithmProvider()); + // Existing JOSE RSA1_5 support substitutes a random CEK after unwrap failure; Brisbane rejects this algorithm. + // codeql[java/rsa-without-oaep] providers.put(CryptoConstants.RSA1_5, new RSAWrapperAlgorithmProvider(new ElytronRsaKeyEncryptionJWEAlgorithmProvider("RSA/ECB/PKCS1Padding"))); providers.put(CryptoConstants.RSA_OAEP, new RSAWrapperAlgorithmProvider(new ElytronRsaKeyEncryptionJWEAlgorithmProvider("RSA/ECB/OAEPWithSHA-1AndMGF1Padding"))); providers.put(CryptoConstants.RSA_OAEP_256, new RSAWrapperAlgorithmProvider(new ElytronRsaKeyEncryption256JWEAlgorithmProvider("RSA/ECB/OAEPWithSHA-256AndMGF1Padding"))); diff --git a/crypto/elytron/src/test/java/org/keycloak/crypto/elytron/WildFlyElytronProviderTest.java b/crypto/elytron/src/test/java/org/keycloak/crypto/elytron/WildFlyElytronProviderTest.java new file mode 100644 index 000000000000..833bb2e36064 --- /dev/null +++ b/crypto/elytron/src/test/java/org/keycloak/crypto/elytron/WildFlyElytronProviderTest.java @@ -0,0 +1,50 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.keycloak.crypto.elytron; + +import java.security.NoSuchAlgorithmException; +import java.security.Provider; + +import org.keycloak.common.crypto.CryptoIntegration; +import org.keycloak.common.crypto.CryptoProvider; + +import org.junit.Test; + +import static org.junit.Assert.assertThrows; + +public class WildFlyElytronProviderTest { + + @Test + public void selectedProviderDoesNotFallBack() { + CryptoProvider previous = CryptoIntegration.isInitialised() ? CryptoIntegration.getProvider() : null; + Provider emptyProvider = new Provider("Empty", "1", "No ciphers") { + }; + try { + CryptoIntegration.setProvider(new WildFlyElytronProvider() { + @Override + public Provider getBouncyCastleProvider() { + return emptyProvider; + } + }); + + assertThrows(NoSuchAlgorithmException.class, + () -> WildFlyElytronProvider.getCipher("AES/CBC/PKCS5Padding")); + } finally { + CryptoIntegration.setProvider(previous); + } + } +} diff --git a/crypto/elytron/src/test/java/org/keycloak/crypto/elytron/test/ElytronCryptoJWETest.java b/crypto/elytron/src/test/java/org/keycloak/crypto/elytron/test/ElytronCryptoJWETest.java index 5067db750ffc..775e4b2bedf5 100644 --- a/crypto/elytron/src/test/java/org/keycloak/crypto/elytron/test/ElytronCryptoJWETest.java +++ b/crypto/elytron/src/test/java/org/keycloak/crypto/elytron/test/ElytronCryptoJWETest.java @@ -33,11 +33,4 @@ public void testDirect_Aes256CbcHmacSha512() throws Exception { testDirectEncryptAndDecrypt(aesKey, hmacKey, JWEConstants.A256CBC_HS512, PAYLOAD, true); } - - @Override - public void testAesKW_Aes128CbcHmacSha256() throws Exception { - // Skipping this test, this test fails when not using BC provider. - - } - } diff --git a/crypto/fips1402/src/main/java/org/keycloak/crypto/fips/Fips1402ProviderFactory.java b/crypto/fips1402/src/main/java/org/keycloak/crypto/fips/Fips1402ProviderFactory.java new file mode 100644 index 000000000000..9338023a7ec0 --- /dev/null +++ b/crypto/fips1402/src/main/java/org/keycloak/crypto/fips/Fips1402ProviderFactory.java @@ -0,0 +1,40 @@ +/* + * Copyright 2026 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.crypto.fips; + +import org.keycloak.common.crypto.CryptoProvider; +import org.keycloak.common.crypto.CryptoProviderFactory; +import org.keycloak.common.crypto.FipsMode; +import org.keycloak.common.crypto.FipsProvider; + +public class Fips1402ProviderFactory implements CryptoProviderFactory { + + @Override + public String getName() { + return FipsProvider.BOUNCY_CASTLE.toString(); + } + + @Override + public CryptoProvider create(FipsMode fipsMode) { + return switch (fipsMode) { + case NON_STRICT -> new FIPS1402Provider(); + case STRICT -> new Fips1402StrictCryptoProvider(); + case DISABLED -> throw new IllegalArgumentException("The Bouncy Castle FIPS provider requires FIPS mode"); + }; + } +} diff --git a/crypto/fips1402/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory b/crypto/fips1402/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory new file mode 100644 index 000000000000..b6048d4e73b8 --- /dev/null +++ b/crypto/fips1402/src/main/resources/META-INF/services/org.keycloak.common.crypto.CryptoProviderFactory @@ -0,0 +1,18 @@ +# +# Copyright 2026 Red Hat, Inc. and/or its affiliates +# and other contributors as indicated by the @author tags. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +org.keycloak.crypto.fips.Fips1402ProviderFactory diff --git a/crypto/pom.xml b/crypto/pom.xml index 3265ecbfbc2c..b58fc7d0c91c 100644 --- a/crypto/pom.xml +++ b/crypto/pom.xml @@ -33,6 +33,7 @@ default fips1402 + brisbane elytron - \ No newline at end of file + diff --git a/docs/brisbane-poc.md b/docs/brisbane-poc.md new file mode 100644 index 000000000000..cb34bbf110af --- /dev/null +++ b/docs/brisbane-poc.md @@ -0,0 +1,222 @@ +# Brisbane FIPS provider PoC + +This PoC follows the structure of [the GlaSSLess prototype](https://github.com/keycloak/keycloak/pull/51082), with Project Brisbane's `JipherJCE` as the Java security provider. Bouncy Castle remains the default; Brisbane requires the `brisbane` feature. It is for evaluation; this work does not establish that a Keycloak deployment is FIPS validated. + +## Brisbane artifact + +The [Brisbane fork](https://github.com/slaskawi/brisbane) publishes the Jipher JAR through JitPack. This PoC pins the tested source commit rather than a moving branch: + +```xml +jitpack.iohttps://jitpack.io + + com.github.slaskawi + brisbane + d50c2f1 + +``` + +The [published POM](https://jitpack.io/com/github/slaskawi/brisbane/d50c2f1/brisbane-d50c2f1.pom) has those coordinates. The resolved JAR is 640,731 bytes with SHA-256 `4bbb57739818203b5a478ef6c44cd9e61357a794d172da42aa9e3cbd8781e102`. The JAR is built from source by JitPack and is unsigned; it must not be treated as a certified cryptographic module. The original local build used `brisbane.jipher:jipher-jce:20.1`, which is no longer required in the local Maven cache. + +## Selecting Brisbane + +Enable Brisbane with `--features=fips,brisbane` and `--fips-mode=non-strict` or `--fips-mode=strict`. The `brisbane` feature depends on `fips`, so Keycloak rejects `--features=brisbane` alone. With only `--features=fips`, Keycloak uses BouncyCastle FIPS. Brisbane strict mode sets `jipher.fips.enforcement=FIPS_STRICT`; non-strict sets `FIPS` before Jipher is initialized. + +Keycloak must register Jipher itself. If `JipherJCE` is already registered, startup fails because the PoC cannot verify the policy that was active when it was initialized. + +## Integration design + +`Profile.Feature.BRISBANE` is experimental and depends on the existing `FIPS` feature. Keycloak's build step selects Brisbane only when that feature is enabled; an ordinary `--features=fips` build continues to select BouncyCastle FIPS. The provider choice is persisted through Quarkus augmentation, so change it by rebuilding the distribution or image. + +The `crypto/brisbane` module registers a `CryptoProviderFactory` through `ServiceLoader`. Its implementation extends Keycloak's existing Elytron provider integration and delegates JCA operations to Jipher, including RSA and EC key generation/factories, signatures, AES-CBC, AES-GCM, and PBKDF2. The Elytron JWE wrappers bind ciphers to the selected Brisbane provider; an algorithm Jipher does not implement fails rather than falling through to SunJCE. Strict mode also preserves Keycloak's allowed RSA key sizes of 2048, 3072, and 4096 bits. Feature-based artifact filtering excludes the Brisbane JAR when Brisbane is off and excludes the BouncyCastle FIPS provider JARs when Brisbane is on. + +The AES-CBC cipher serves only Keycloak's JOSE CBC-HMAC encryption; the JWE decoder checks its authentication tag before decrypting ciphertext. Brisbane rejects provider fallback if Jipher does not implement AES-CBC. + +Brisbane rejects `RSA1_5` JWE key management. The [OpenSSL 3.1.2 FIPS 140-3 security policy](https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp4985.pdf) lists RSA-OAEP, not RSAES-PKCS1-v1_5, for approved RSA key transport; [NIST's transition guidance](https://csrc.nist.gov/projects/cryptographic-module-validation-program/programmatic-transitions) ended allowance for PKCS#1 v1.5-only RSA key transport on January 1, 2024. This restriction applies to Brisbane's JWE provider in this PoC. Keycloak's default and Bouncy Castle providers retain their existing behavior, and other encryption paths still require an audit before any FIPS compliance claim. The shared Elytron provider still supports legacy `RSA1_5` with Keycloak's random-CEK fallback; its CodeQL warning is documented and narrowly suppressed on that unchanged compatibility path. + +The Brisbane factory sets `jipher.fips.enforcement` before loading `JipherJCE`. Strict mode uses `FIPS_STRICT` and requires Jipher to have Java security provider priority one. If Jipher was previously registered, startup fails because its initial enforcement setting cannot be established by this integration. + +Brisbane requires Java 25 or later at runtime. Keycloak's local build guidance supports JDK 17, 21, or 25, so JDK 25 is the shared supported version. With the JAR on Keycloak's class path, the JVM also needs `--enable-native-access=ALL-UNNAMED`. Jipher loads OpenSSL 3's cryptographic library, FIPS provider, and configuration file from the filesystem. Configure `-Djipher.openssl.dir=` with the layout described in [Brisbane's prerequisites](https://github.com/openjdk/brisbane/blob/master/doc/prerequisites.md). On Oracle Linux 9.4 or later, Brisbane also documents `-Djipher.openssl.useOsInstance=true` for the OS-provided instance. + +## OpenSSL 3 runtime on macOS and Linux + +OpenSSL [lists 3.1.2 as FIPS 140-3 validated](https://www.openssl-library.org/source/) under [certificate #4985](https://csrc.nist.gov/projects/cryptographic-module-validation-program/certificate/4985). Its [FIPS build guide](https://github.com/openssl/openssl/blob/master/README-FIPS.md) permits that provider with a newer supported OpenSSL 3 library. This build uses the 3.1.2 FIPS provider and the supported 3.5.9 LTS library. The 3.5.9 FIPS provider must not be used in its place. + +The official source tarballs and their SHA-256 files were downloaded from the OpenSSL GitHub releases. The verified tarball hashes were `a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539` for 3.1.2 and `603f5602e2eef00d77fbd429d34dcd5822bb301757a1bc9cdb24c670f1eb859a` for 3.5.9. Build the native libraries on each target platform. The steps below ran on macOS ARM64 and Ubuntu 24.04 ARM64 in a disposable container. + +```sh +# Set these to absolute paths. Run from a disposable work directory. +OPENSSL_WORK=/path/to/openssl-work +OPENSSL_PREFIX="$OPENSSL_WORK/install" +mkdir -p "$OPENSSL_WORK" +cd "$OPENSSL_WORK" + +for version in 3.1.2 3.5.9; do + curl -fL --retry 3 -o "openssl-$version.tar.gz" \ + "https://github.com/openssl/openssl/releases/download/openssl-$version/openssl-$version.tar.gz" + curl -fL --retry 3 -o "openssl-$version.tar.gz.sha256" \ + "https://github.com/openssl/openssl/releases/download/openssl-$version/openssl-$version.tar.gz.sha256" +done + +for version in 3.1.2 3.5.9; do + actual=$(openssl dgst -sha256 -r "openssl-$version.tar.gz" | awk '{print $1}') + expected=$(awk '{print $1}' "openssl-$version.tar.gz.sha256") + test "$actual" = "$expected" || { echo "OpenSSL $version checksum mismatch" >&2; exit 1; } +done +tar -xzf openssl-3.1.2.tar.gz +tar -xzf openssl-3.5.9.tar.gz + +for version in 3.1.2 3.5.9; do + cd "$OPENSSL_WORK/openssl-$version" + ./Configure enable-fips --prefix="$OPENSSL_PREFIX" \ + --openssldir="$OPENSSL_PREFIX/ssl" --libdir=lib + make -j4 +done + +# Install the supported library, then only the validated FIPS provider. +cd "$OPENSSL_WORK/openssl-3.5.9" +make install_sw install_ssldirs +cd "$OPENSSL_WORK/openssl-3.1.2" +make install_fips +``` + +`--libdir=lib` yields Brisbane's expected layout on both platforms: `lib/libcrypto.3.dylib` and `lib/ossl-modules/fips.dylib` on macOS; `lib/libcrypto.so.3` and `lib/ossl-modules/fips.so` on Linux; plus `ssl/fipsmodule.cnf`. The FIPS module configuration must be generated on each target machine, not copied from another machine. On macOS, the 3.1.2 `openssl fipsinstall` self-tests and its `-verify` command passed for the installed provider. For FIPS deployment, follow the [module security policy](https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp4985.pdf), including its operating-environment and installation requirements. + +Verify the installed module and library versions: + +```sh +case "$(uname -s)" in + Darwin) FIPS_MODULE=fips.dylib ;; + Linux) FIPS_MODULE=fips.so; export LD_LIBRARY_PATH="$OPENSSL_PREFIX/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" ;; +esac +cd "$OPENSSL_WORK/openssl-3.1.2" +./apps/openssl fipsinstall -out "$OPENSSL_WORK/fipsmodule-selftest.cnf" \ + -module "$OPENSSL_PREFIX/lib/ossl-modules/$FIPS_MODULE" +./apps/openssl fipsinstall -verify -in "$OPENSSL_WORK/fipsmodule-selftest.cnf" \ + -module "$OPENSSL_PREFIX/lib/ossl-modules/$FIPS_MODULE" + +cat > "$OPENSSL_PREFIX/ssl/openssl-fips.cnf" < @@ -115,14 +123,13 @@ NOTE: You can disable logging in production if everything works as expected. == Strict mode -There is the `fips-mode` option, which is automatically set to `non-strict` when the `fips` feature is enabled. This means to run BCFIPS in the "non-approved mode". -The more secure alternative is to use `--features=fips --fips-mode=strict` in which case BouncyCastle FIPS will use "approved mode". -Using that option results in stricter security requirements on cryptography and security algorithms. +The `fips-mode` option defaults to `non-strict` when the `fips` feature is enabled. With BouncyCastle, this runs BCFIPS in "non-approved mode"; `strict` runs BCFIPS in "approved mode". With Brisbane, the modes select Jipher's `FIPS` and `FIPS_STRICT` enforcement policies, respectively. +Use `--features=fips --fips-mode=strict` for BouncyCastle or `--features=fips,brisbane --fips-mode=strict` for Brisbane. -NOTE: In strict mode, the default keystore type (as well as default truststore type) is BCFKS. If you want to use a different keystore type +NOTE: In strict mode with BouncyCastle, the default keystore type (as well as default truststore type) is BCFKS. If you want to use a different keystore type it is required to use the option `--https-key-store-type` with appropriate type. A similar command might be needed for the truststore as well if you want to use it. -When starting the server, you can check that the startup log contains `KC` provider with the note about `Approved Mode` such as the following: +When starting with BouncyCastle, you can check that the startup log contains `KC` provider with the note about `Approved Mode` such as the following: [source] ---- @@ -131,8 +138,7 @@ FIPS1402Provider created: KC(BCFIPS version 2.0103 Approved Mode, FIPS-JVM: enab === Cryptography restrictions in strict mode -* As mentioned in the previous section, strict mode may not work with `pkcs12` keystore. It is required to use another keystore (like `bcfks`) as mentioned earlier. Also `jks` and `pkcs12` keystores are not -supported in {project_name} when using strict mode. Some examples are importing or generating a keystore of an OIDC or SAML client in the Admin Console or for a `java-keystore` provider in the realm keys. +* With BouncyCastle in strict mode, `jks` and `pkcs12` keystores are not supported. Use `bcfks` for the server keystore and for keystores of OIDC or SAML clients and realm keys. * User passwords must be 14 characters or longer. {project_name} uses PBKDF2 based password encoding by default. BCFIPS approved mode requires passwords to be at least 112 bits (effectively 14 characters) with PBKDF2 algorithm. If you want to allow a shorter password, set the property `max-padding-length` of provider `pbkdf2-sha512` of SPI `password-hashing` diff --git a/pom.xml b/pom.xml index 84f2a8fd5911..6411e7a68997 100644 --- a/pom.xml +++ b/pom.xml @@ -78,6 +78,7 @@ 2.1.3 2.1.25 2.1.8 + d50c2f1 2.1.3 2.4.240 @@ -293,6 +294,13 @@ + + + jitpack.io + https://jitpack.io + + + JIRA https://github.com/keycloak/keycloak/issues @@ -447,6 +455,11 @@ bcutil-fips ${bouncycastle.bcutilfips.version} + + com.github.slaskawi + brisbane + ${brisbane.version} + com.github.ua-parser @@ -1216,6 +1229,11 @@ keycloak-crypto-elytron ${project.version} + + org.keycloak + keycloak-crypto-brisbane + ${project.version} + org.keycloak keycloak-admin-cli diff --git a/quarkus/config-api/src/main/java/org/keycloak/config/HttpOptions.java b/quarkus/config-api/src/main/java/org/keycloak/config/HttpOptions.java index a8f6bb55dda1..f15d40d52f9c 100644 --- a/quarkus/config-api/src/main/java/org/keycloak/config/HttpOptions.java +++ b/quarkus/config-api/src/main/java/org/keycloak/config/HttpOptions.java @@ -109,7 +109,7 @@ public enum ClientAuth { .category(OptionCategory.HTTP) .description("The type of the key store file. " + "If not given, the type is automatically detected based on the file extension. " + - "If '" + SecurityOptions.FIPS_MODE.getKey() + "' is set to '" + FipsMode.STRICT + "' and no value is set, it defaults to 'BCFKS'.") + "If '" + SecurityOptions.FIPS_MODE.getKey() + "' is set to '" + FipsMode.STRICT + "', Bouncy Castle is selected as the FIPS provider, and no value is set, it defaults to 'BCFKS'.") .build(); public static final Option HTTPS_TRUST_STORE_FILE = new OptionBuilder<>("https-trust-store-file", File.class) @@ -126,7 +126,7 @@ public enum ClientAuth { .category(OptionCategory.HTTP) .description("The type of the trust store file. " + "If not given, the type is automatically detected based on the file extension. " + - "If '" + SecurityOptions.FIPS_MODE.getKey() + "' is set to '" + FipsMode.STRICT + "' and no value is set, it defaults to 'BCFKS'.") + "If '" + SecurityOptions.FIPS_MODE.getKey() + "' is set to '" + FipsMode.STRICT + "', Bouncy Castle is selected as the FIPS provider, and no value is set, it defaults to 'BCFKS'.") .build(); public static final Option HTTP_MAX_QUEUED_REQUESTS = new OptionBuilder<>("http-max-queued-requests", Integer.class) diff --git a/quarkus/container/Dockerfile.brisbane b/quarkus/container/Dockerfile.brisbane new file mode 100644 index 000000000000..11aea19240b6 --- /dev/null +++ b/quarkus/container/Dockerfile.brisbane @@ -0,0 +1,49 @@ +# Build with a local Keycloak distribution tarball as the Docker context. +FROM registry.access.redhat.com/ubi9/ubi:9.8 AS openssl-build + +RUN dnf install -y gcc make perl-core && dnf clean all + +# OpenSSL 3.1.2 supplies the FIPS 140-3 validated provider; 3.5.9 supplies libcrypto. +ADD --checksum=sha256:a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539 \ + https://github.com/openssl/openssl/releases/download/openssl-3.1.2/openssl-3.1.2.tar.gz /tmp/openssl-3.1.2.tar.gz +ADD --checksum=sha256:603f5602e2eef00d77fbd429d34dcd5822bb301757a1bc9cdb24c670f1eb859a \ + https://github.com/openssl/openssl/releases/download/openssl-3.5.9/openssl-3.5.9.tar.gz /tmp/openssl-3.5.9.tar.gz + +RUN cd /tmp && tar -xzf openssl-3.1.2.tar.gz && tar -xzf openssl-3.5.9.tar.gz +RUN cd /tmp/openssl-3.5.9 && \ + ./Configure enable-fips --prefix=/opt/jipher/openssl --openssldir=/opt/jipher/openssl/ssl --libdir=lib && \ + make -j4 && make install_sw install_ssldirs +RUN cd /tmp/openssl-3.1.2 && \ + ./Configure enable-fips --prefix=/opt/jipher/openssl --openssldir=/opt/jipher/openssl/ssl --libdir=lib && \ + make -j4 && make install_fips +RUN LD_LIBRARY_PATH=/opt/jipher/openssl/lib \ + /opt/jipher/openssl/bin/openssl fipsinstall \ + -out /tmp/fips-selftest.cnf \ + -module /opt/jipher/openssl/lib/ossl-modules/fips.so && \ + LD_LIBRARY_PATH=/opt/jipher/openssl/lib \ + /opt/jipher/openssl/bin/openssl fipsinstall -verify \ + -in /tmp/fips-selftest.cnf \ + -module /opt/jipher/openssl/lib/ossl-modules/fips.so + +FROM registry.access.redhat.com/ubi9/ubi:9.8 + +ARG KEYCLOAK_VERSION=999.0.0-SNAPSHOT +RUN dnf install -y java-25-openjdk-headless tar gzip && dnf clean all + +COPY --from=openssl-build /opt/jipher/openssl /opt/jipher/openssl +COPY keycloak-${KEYCLOAK_VERSION}.tar.gz /tmp/keycloak.tar.gz +RUN mkdir -p /opt/keycloak && \ + tar -xzf /tmp/keycloak.tar.gz -C /opt/keycloak --strip-components=1 && \ + rm /tmp/keycloak.tar.gz && \ + chown -R 1000:0 /opt/keycloak && \ + chmod -R g+rwX /opt/keycloak + +ENV KC_RUN_IN_CONTAINER=true \ + LD_LIBRARY_PATH=/opt/jipher/openssl/lib \ + JAVA_OPTS_APPEND="--enable-native-access=ALL-UNNAMED -Djipher.openssl.dir=/opt/jipher/openssl" + +USER 1000 +RUN /opt/keycloak/bin/kc.sh build --features=fips,brisbane --fips-mode=strict + +EXPOSE 8080 8443 9000 +ENTRYPOINT ["/opt/keycloak/bin/kc.sh"] diff --git a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java index cadf392c52a4..8d71e50a9b92 100644 --- a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java +++ b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java @@ -55,6 +55,7 @@ import org.keycloak.authorization.policy.provider.js.DeployedScriptPolicyFactory; import org.keycloak.common.Profile; import org.keycloak.common.crypto.FipsMode; +import org.keycloak.common.crypto.FipsProvider; import org.keycloak.common.util.MultiSiteUtils; import org.keycloak.common.util.StreamUtil; import org.keycloak.config.DatabaseOptions; @@ -1041,8 +1042,10 @@ public List scan(MethodInfo method, ClassInfo actualEndp @Record(ExecutionTime.STATIC_INIT) void initCrypto(KeycloakRecorder recorder) { FipsMode fipsMode = getFipsMode(); - recorder.setCryptoProvider(fipsMode); - recorder.configureTruststore(fipsMode); + FipsProvider fipsProvider = Profile.isFeatureEnabled(Profile.Feature.BRISBANE) + ? FipsProvider.BRISBANE : FipsProvider.BOUNCY_CASTLE; + recorder.setCryptoProvider(fipsMode, fipsProvider); + recorder.configureTruststore(fipsMode, fipsProvider); } private FipsMode getFipsMode() { diff --git a/quarkus/runtime/pom.xml b/quarkus/runtime/pom.xml index 420736496b34..1ae9449d6bea 100644 --- a/quarkus/runtime/pom.xml +++ b/quarkus/runtime/pom.xml @@ -209,6 +209,20 @@ + + org.keycloak + keycloak-crypto-brisbane + + + * + * + + + + + org.keycloak + keycloak-crypto-elytron + org.keycloak keycloak-server-spi diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/KeycloakRecorder.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/KeycloakRecorder.java index ba656371f9eb..8047cfc2589a 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/KeycloakRecorder.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/KeycloakRecorder.java @@ -37,8 +37,8 @@ import org.keycloak.common.Profile.Enablement; import org.keycloak.common.Profile.Feature; import org.keycloak.common.crypto.CryptoIntegration; -import org.keycloak.common.crypto.CryptoProvider; import org.keycloak.common.crypto.FipsMode; +import org.keycloak.common.crypto.FipsProvider; import org.keycloak.common.util.KeystoreUtil.TruststoreFormat; import org.keycloak.config.DatabaseOptions; import org.keycloak.config.HealthOptions; @@ -187,7 +187,7 @@ private static void extractHost(Option option, Set allowedHosts) } } - public void configureTruststore(FipsMode fipsMode) { + public void configureTruststore(FipsMode fipsMode, FipsProvider fipsProvider) { List truststores = new ArrayList<>(); Configuration.getOptionalKcValue(TruststoreOptions.TRUSTSTORE_PATHS.getKey()) .ifPresent(s -> Stream.of(s.split(",")).forEach(truststores::add)); @@ -208,7 +208,9 @@ public void configureTruststore(FipsMode fipsMode) { return; // nothing to configure, we'll just use the system default } - TruststoreFormat truststoreType = fipsMode == FipsMode.STRICT ? TruststoreFormat.BCFKS : null; + TruststoreFormat truststoreType = fipsMode == FipsMode.STRICT + && fipsProvider == FipsProvider.BOUNCY_CASTLE + ? TruststoreFormat.BCFKS : null; TruststoreBuilder.setSystemTruststore(truststores.toArray(String[]::new), true, dataDir.orElseThrow(), truststoreType); } @@ -321,19 +323,20 @@ public HibernateOrmIntegrationRuntimeInitListener createDefaultUnitListener() { return propertyCollector -> propertyCollector.accept(AvailableSettings.DEFAULT_SCHEMA, Configuration.getConfigValue(DatabaseOptions.DB_SCHEMA).getValue()); } - public void setCryptoProvider(FipsMode fipsMode) { - String cryptoProvider = fipsMode.getProviderClassName(); + public void setCryptoProvider(FipsMode fipsMode, FipsProvider fipsProvider) { + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + String providerName = fipsMode.isFipsEnabled() ? fipsProvider.toString() : "default"; try { - CryptoIntegration.setProvider( - (CryptoProvider) Thread.currentThread().getContextClassLoader().loadClass(cryptoProvider).getDeclaredConstructor().newInstance()); - } catch (ClassNotFoundException | NoClassDefFoundError cause) { + CryptoIntegration.init(classLoader, providerName, fipsMode); + } catch (RuntimeException | LinkageError cause) { if (fipsMode.isFipsEnabled()) { - throw new RuntimeException("Failed to configure FIPS. Make sure you have added the Bouncy Castle FIPS dependencies to the 'providers' directory."); + if (fipsProvider == FipsProvider.BOUNCY_CASTLE) { + throw new RuntimeException("Failed to configure FIPS. Make sure you have added the Bouncy Castle FIPS dependencies to the 'providers' directory.", cause); + } + throw new RuntimeException("Failed to configure Brisbane. Jipher 20.1, Java 25 or later, and a configured OpenSSL FIPS provider are required.", cause); } - throw new RuntimeException("Unexpected error when configuring the crypto provider: " + cryptoProvider, cause); - } catch (Exception cause) { - throw new RuntimeException("Unexpected error when configuring the crypto provider: " + cryptoProvider, cause); + throw new RuntimeException("Unexpected error when configuring the crypto provider: " + providerName, cause); } } diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/IgnoredArtifacts.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/IgnoredArtifacts.java index 65e7c3e97a7c..ad4ed6f0bc62 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/IgnoredArtifacts.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/IgnoredArtifacts.java @@ -62,6 +62,23 @@ public static Set getDefaultIgnoredArtifacts() { ); public static final Set FIPS_DISABLED = Set.of( + "org.keycloak:keycloak-crypto-fips1402", + "org.bouncycastle:bc-fips", + "org.bouncycastle:bctls-fips", + "org.bouncycastle:bcpkix-fips", + "org.bouncycastle:bcutil-fips", + "com.github.slaskawi:brisbane", + "org.keycloak:keycloak-crypto-brisbane", + "org.keycloak:keycloak-crypto-elytron" + ); + + public static final Set BRISBANE_DISABLED = Set.of( + "com.github.slaskawi:brisbane", + "org.keycloak:keycloak-crypto-brisbane", + "org.keycloak:keycloak-crypto-elytron" + ); + + public static final Set BRISBANE_ENABLED = Set.of( "org.keycloak:keycloak-crypto-fips1402", "org.bouncycastle:bc-fips", "org.bouncycastle:bctls-fips", @@ -73,7 +90,12 @@ private static Set fips() { final Profile profile = getCurrentOrCreateFeatureProfile(); boolean isFipsEnabled = profile.getFeatures().get(Profile.Feature.FIPS); - return isFipsEnabled ? FIPS_ENABLED : FIPS_DISABLED; + if (!isFipsEnabled) { + return FIPS_DISABLED; + } + return Stream.concat(FIPS_ENABLED.stream(), + (profile.isFeatureEnabled(Profile.Feature.BRISBANE) ? BRISBANE_ENABLED : BRISBANE_DISABLED).stream()) + .collect(Collectors.toUnmodifiableSet()); } // JDBC Drivers diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/HttpPropertyMappers.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/HttpPropertyMappers.java index 607351b6d1c6..e9e88a09f887 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/HttpPropertyMappers.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/HttpPropertyMappers.java @@ -458,6 +458,9 @@ private static void validateFipsStoreFormat(Option storeFileOption, Option if (!FipsMode.STRICT.toString().equals(fipsMode)) { return; } + if (!isBouncyCastleFips()) { + return; + } if (Configuration.isSet(storeTypeOption)) { return; } @@ -497,7 +500,7 @@ private static void validateTrustStorePassword(Option trustStoreFileOption private static void validateNoFipsPem() { String fipsMode = getOptionalKcValue(SecurityOptions.FIPS_MODE.getKey()).orElse(null); - if (!FipsMode.STRICT.toString().equals(fipsMode)) { + if (!FipsMode.STRICT.toString().equals(fipsMode) || !isBouncyCastleFips()) { return; } if (getOptionalKcValue(HttpOptions.HTTPS_CERTIFICATE_FILE.getKey()).isPresent()) { @@ -510,6 +513,10 @@ private static void validateNoFipsPem() { } } + private static boolean isBouncyCastleFips() { + return !Profile.isFeatureEnabled(Profile.Feature.BRISBANE); + } + private static void validateStoreType(Option storeFileOption, Option storeTypeOption, StoreRole role) { String filePath = getOptionalKcValue(storeFileOption.getKey()).orElse(null); if (filePath == null) { @@ -587,10 +594,10 @@ static File getDefaultKeystorePathValue() { static String resolveKeyStoreType(String value, ConfigSourceInterceptorContext configSourceInterceptorContext) { - if (FipsMode.STRICT.toString().equals(value)) { - return "BCFKS"; + if (!FipsMode.STRICT.toString().equals(value)) { + return null; } - return null; + return isBouncyCastleFips() ? "BCFKS" : null; } private static String resolveMaxThreads(String value, diff --git a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/cli/PicocliTest.java b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/cli/PicocliTest.java index 220baeb5f1fd..41eb914277a3 100644 --- a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/cli/PicocliTest.java +++ b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/cli/PicocliTest.java @@ -157,6 +157,14 @@ public void testPemRejectedInFipsMode() { assertError(nonRunningPicocli, "https-key-store-file"); } + @Test + public void testPemAcceptedWithBrisbaneInFipsStrictMode() { + NonRunningPicocli nonRunningPicocli = pseudoLaunch("start-dev", + "--https-certificate-file=/cert.pem", "--https-certificate-key-file=/key.pem", + "--fips-mode=strict", "--features=fips,brisbane"); + assertNoError(nonRunningPicocli); + } + @Test public void testPemAcceptedInFipsNonStrictMode() { NonRunningPicocli nonRunningPicocli = pseudoLaunch("start-dev", @@ -239,6 +247,14 @@ public void testFipsStrictRejectsPkcs12Extension() { assertError(nonRunningPicocli, "appears to be PKCS12 based on its extension, but FIPS strict mode requires BCFKS"); } + @Test + public void testFipsStrictAcceptsPkcs12WithBrisbane() { + NonRunningPicocli nonRunningPicocli = pseudoLaunch("start-dev", + "--https-key-store-file=server.p12", "--https-key-store-password=pass", + "--fips-mode=strict", "--features=fips,brisbane"); + assertNoError(nonRunningPicocli); + } + @Test public void testManagementKeystoreUnrecognizedExtension() { putEnvVars(Map.of( diff --git a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/IgnoredArtifactsTest.java b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/IgnoredArtifactsTest.java index f9b722e5471a..8ce663c54211 100644 --- a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/IgnoredArtifactsTest.java +++ b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/IgnoredArtifactsTest.java @@ -69,6 +69,21 @@ public void fipsEnabled() { var ignoredArtifacts = IgnoredArtifacts.getDefaultIgnoredArtifacts(); assertThat(ignoredArtifacts.containsAll(IgnoredArtifacts.FIPS_ENABLED), is(true)); + assertThat(ignoredArtifacts.containsAll(IgnoredArtifacts.BRISBANE_DISABLED), is(true)); + assertThat(ignoredArtifacts.contains("org.keycloak:keycloak-crypto-fips1402"), is(false)); + } + + @Test + public void brisbaneEnabled() { + var profile = getProfileWithEnabledFeature(Profile.Feature.FIPS, Profile.Feature.BRISBANE); + assertThat(profile.isFeatureEnabled(Profile.Feature.BRISBANE), is(true)); + + var ignoredArtifacts = IgnoredArtifacts.getDefaultIgnoredArtifacts(); + assertThat(ignoredArtifacts.containsAll(IgnoredArtifacts.FIPS_ENABLED), is(true)); + assertThat(ignoredArtifacts.containsAll(IgnoredArtifacts.BRISBANE_ENABLED), is(true)); + assertThat(ignoredArtifacts.contains("com.github.slaskawi:brisbane"), is(false)); + assertThat(ignoredArtifacts.contains("org.keycloak:keycloak-crypto-brisbane"), is(false)); + assertThat(ignoredArtifacts.contains("org.keycloak:keycloak-crypto-elytron"), is(false)); } @Test @@ -201,9 +216,11 @@ private void assertIgnoredArtifacts(Set artifactsSet, Option en }); } - private Profile getProfileWithEnabledFeature(Profile.Feature feature) { + private Profile getProfileWithEnabledFeature(Profile.Feature... features) { Properties properties = new Properties(); - properties.setProperty("keycloak.profile.feature.%s".formatted(feature.name().toLowerCase()), "enabled"); + for (Profile.Feature feature : features) { + properties.setProperty("keycloak.profile.feature.%s".formatted(feature.name().toLowerCase()), "enabled"); + } return Profile.configure(new PropertiesProfileConfigResolver(properties)); } } diff --git a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/ManagementConfigurationTest.java b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/ManagementConfigurationTest.java index 2c6b313f0d32..6a39ebaf76d5 100644 --- a/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/ManagementConfigurationTest.java +++ b/quarkus/runtime/src/test/java/org/keycloak/quarkus/runtime/configuration/ManagementConfigurationTest.java @@ -319,9 +319,11 @@ public void managementEnabledDefaultHttpsKeystore(){ } @Test - public void fipsKeystoreType(){ + public void bouncyCastleFipsKeystoreType() { makeInterfaceOccupied(); - putEnvVar("KC_FIPS_MODE", "strict"); + putEnvVars(Map.of( + "KC_FIPS_MODE", "strict" + )); initConfig(); @@ -332,6 +334,21 @@ public void fipsKeystoreType(){ assertManagementEnabled(true); } + @Test + public void brisbaneFipsKeystoreType() { + makeInterfaceOccupied(); + putEnvVars(Map.of( + "KC_FIPS_MODE", "strict", + "KC_FEATURES", "fips,brisbane" + )); + + initConfig(); + + assertConfigNull("https-key-store-type"); + assertConfigNull("https-management-key-store-type"); + assertManagementEnabled(true); + } + @Test public void keystoreType(){ makeInterfaceOccupied(); diff --git a/quarkus/server/pom.xml b/quarkus/server/pom.xml index 65cdccc0f240..9bd0b90e78f9 100644 --- a/quarkus/server/pom.xml +++ b/quarkus/server/pom.xml @@ -21,6 +21,16 @@ org.keycloak keycloak-quarkus-server + + com.github.slaskawi + brisbane + runtime + + + org.keycloak + keycloak-crypto-elytron + runtime + org.keycloak diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelp.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelp.approved.txt index ba8bff4b9314..608559beb4e5 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelp.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelp.approved.txt @@ -338,8 +338,9 @@ HTTP(S): The password of the key store file. Default: password. --https-key-store-type The type of the key store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --https-port The used HTTPS port. Default: 8443. --https-protocols The list of protocols to explicitly enable. If a value is not supported by the @@ -352,8 +353,9 @@ HTTP(S): The password of the trust store file. --https-trust-store-type The type of the trust store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --shutdown-delay Length of the pre-shutdown phase during which the server prepares for shutdown. May be an ISO 8601 duration value, an integer number of seconds, diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt index 7f05fc522edb..af3ef660f617 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartDevHelpAll.approved.txt @@ -431,8 +431,9 @@ HTTP(S): The password of the key store file. Default: password. --https-key-store-type The type of the key store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --https-port The used HTTPS port. Default: 8443. --https-protocols The list of protocols to explicitly enable. If a value is not supported by the @@ -445,8 +446,9 @@ HTTP(S): The password of the trust store file. --https-trust-store-type The type of the trust store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --shutdown-delay Length of the pre-shutdown phase during which the server prepares for shutdown. May be an ISO 8601 duration value, an integer number of seconds, diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelp.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelp.approved.txt index fd3d345e820d..c206ea570bcf 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelp.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelp.approved.txt @@ -400,8 +400,9 @@ HTTP(S): The password of the key store file. Default: password. --https-key-store-type The type of the key store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --https-port The used HTTPS port. Default: 8443. --https-protocols The list of protocols to explicitly enable. If a value is not supported by the @@ -414,8 +415,9 @@ HTTP(S): The password of the trust store file. --https-trust-store-type The type of the trust store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --shutdown-delay Length of the pre-shutdown phase during which the server prepares for shutdown. May be an ISO 8601 duration value, an integer number of seconds, diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt index b2561cad9f9e..5aa88756f8fb 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartHelpAll.approved.txt @@ -432,8 +432,9 @@ HTTP(S): The password of the key store file. Default: password. --https-key-store-type The type of the key store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --https-port The used HTTPS port. Default: 8443. --https-protocols The list of protocols to explicitly enable. If a value is not supported by the @@ -446,8 +447,9 @@ HTTP(S): The password of the trust store file. --https-trust-store-type The type of the trust store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --shutdown-delay Length of the pre-shutdown phase during which the server prepares for shutdown. May be an ISO 8601 duration value, an integer number of seconds, diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelp.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelp.approved.txt index f7b95b9ddb9a..acb717ba7a19 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelp.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelp.approved.txt @@ -364,8 +364,9 @@ HTTP(S): The password of the key store file. Default: password. --https-key-store-type The type of the key store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --https-port The used HTTPS port. Default: 8443. --https-protocols The list of protocols to explicitly enable. If a value is not supported by the @@ -378,8 +379,9 @@ HTTP(S): The password of the trust store file. --https-trust-store-type The type of the trust store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --shutdown-delay Length of the pre-shutdown phase during which the server prepares for shutdown. May be an ISO 8601 duration value, an integer number of seconds, diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt index 689f98fb0461..039f4c5f7a5e 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testStartOptimizedHelpAll.approved.txt @@ -396,8 +396,9 @@ HTTP(S): The password of the key store file. Default: password. --https-key-store-type The type of the key store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --https-port The used HTTPS port. Default: 8443. --https-protocols The list of protocols to explicitly enable. If a value is not supported by the @@ -410,8 +411,9 @@ HTTP(S): The password of the trust store file. --https-trust-store-type The type of the trust store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --shutdown-delay Length of the pre-shutdown phase during which the server prepares for shutdown. May be an ISO 8601 duration value, an integer number of seconds, diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelp.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelp.approved.txt index 7988360c7d88..ac2cdf9fcf6b 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelp.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelp.approved.txt @@ -399,8 +399,9 @@ HTTP(S): The password of the key store file. Default: password. --https-key-store-type The type of the key store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --https-port The used HTTPS port. Default: 8443. --https-protocols The list of protocols to explicitly enable. If a value is not supported by the @@ -413,8 +414,9 @@ HTTP(S): The password of the trust store file. --https-trust-store-type The type of the trust store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --shutdown-delay Length of the pre-shutdown phase during which the server prepares for shutdown. May be an ISO 8601 duration value, an integer number of seconds, diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelpAll.approved.txt index 2704f90ee3f2..95c01a07fe5a 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityCheckHelpAll.approved.txt @@ -431,8 +431,9 @@ HTTP(S): The password of the key store file. Default: password. --https-key-store-type The type of the key store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --https-port The used HTTPS port. Default: 8443. --https-protocols The list of protocols to explicitly enable. If a value is not supported by the @@ -445,8 +446,9 @@ HTTP(S): The password of the trust store file. --https-trust-store-type The type of the trust store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --shutdown-delay Length of the pre-shutdown phase during which the server prepares for shutdown. May be an ISO 8601 duration value, an integer number of seconds, diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelp.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelp.approved.txt index 7e62efe72f32..f7d396dc3f7e 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelp.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelp.approved.txt @@ -397,8 +397,9 @@ HTTP(S): The password of the key store file. Default: password. --https-key-store-type The type of the key store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --https-port The used HTTPS port. Default: 8443. --https-protocols The list of protocols to explicitly enable. If a value is not supported by the @@ -411,8 +412,9 @@ HTTP(S): The password of the trust store file. --https-trust-store-type The type of the trust store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --shutdown-delay Length of the pre-shutdown phase during which the server prepares for shutdown. May be an ISO 8601 duration value, an integer number of seconds, diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelpAll.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelpAll.approved.txt index 838b9a34c629..062a698ffcf0 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelpAll.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/dist/approvals/cli/help/HelpCommandDistTest.testUpdateCompatibilityMetadataHelpAll.approved.txt @@ -429,8 +429,9 @@ HTTP(S): The password of the key store file. Default: password. --https-key-store-type The type of the key store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --https-port The used HTTPS port. Default: 8443. --https-protocols The list of protocols to explicitly enable. If a value is not supported by the @@ -443,8 +444,9 @@ HTTP(S): The password of the trust store file. --https-trust-store-type The type of the trust store file. If not given, the type is automatically - detected based on the file extension. If 'fips-mode' is set to 'strict' and - no value is set, it defaults to 'BCFKS'. + detected based on the file extension. If 'fips-mode' is set to 'strict', + Bouncy Castle is selected as the FIPS provider, and no value is set, it + defaults to 'BCFKS'. --shutdown-delay Length of the pre-shutdown phase during which the server prepares for shutdown. May be an ISO 8601 duration value, an integer number of seconds,