diff --git a/services/src/main/java/org/keycloak/keys/JavaKeystoreKeyProvider.java b/services/src/main/java/org/keycloak/keys/JavaKeystoreKeyProvider.java index 6dafffa218..35b6eb1a44 100644 --- a/services/src/main/java/org/keycloak/keys/JavaKeystoreKeyProvider.java +++ b/services/src/main/java/org/keycloak/keys/JavaKeystoreKeyProvider.java @@ -93,7 +93,8 @@ public class JavaKeystoreKeyProvider implements KeyProvider { String keyAlias = model.get(JavaKeystoreKeyProviderFactory.KEY_ALIAS_KEY); return switch (algorithm) { - case Algorithm.PS256, Algorithm.PS384, Algorithm.PS512, Algorithm.RS256, Algorithm.RS384, Algorithm.RS512 -> + case Algorithm.PS256, Algorithm.PS384, Algorithm.PS512, Algorithm.RS256, Algorithm.RS384, Algorithm.RS512, + Algorithm.RSA_OAEP, Algorithm.RSA1_5, Algorithm.RSA_OAEP_256 -> loadRSAKey(realm, model, keyStore, keyAlias); case Algorithm.ES256, Algorithm.ES384, Algorithm.ES512 -> loadECKey(realm, model, keyStore, keyAlias); default -> diff --git a/services/src/main/java/org/keycloak/keys/JavaKeystoreKeyProviderFactory.java b/services/src/main/java/org/keycloak/keys/JavaKeystoreKeyProviderFactory.java index fcdaa23bb9..ff2408bcd7 100644 --- a/services/src/main/java/org/keycloak/keys/JavaKeystoreKeyProviderFactory.java +++ b/services/src/main/java/org/keycloak/keys/JavaKeystoreKeyProviderFactory.java @@ -30,6 +30,7 @@ import org.keycloak.provider.ConfigurationValidationHelper; import org.keycloak.provider.ProviderConfigProperty; import org.keycloak.provider.ProviderConfigurationBuilder; +import java.util.Collection; import java.util.List; import java.util.stream.Stream; @@ -118,7 +119,10 @@ public class JavaKeystoreKeyProviderFactory implements KeyProviderFactory { // merge the algorithms supported for RSA and EC keys and provide them as one configuration property private static ProviderConfigProperty mergedAlgorithmProperties() { List ecAlgorithms = List.of(Algorithm.ES256, Algorithm.ES384, Algorithm.ES512); - List algorithms = Stream.concat(Attributes.RS_ALGORITHM_PROPERTY.getOptions().stream(), ecAlgorithms.stream()).toList(); + List algorithms = Stream.of(Attributes.RS_ALGORITHM_PROPERTY.getOptions(), + ecAlgorithms, Attributes.RS_ENC_ALGORITHM_PROPERTY.getOptions()) + .flatMap(Collection::stream) + .toList(); return new ProviderConfigProperty(Attributes.RS_ALGORITHM_PROPERTY.getName(), Attributes.RS_ALGORITHM_PROPERTY.getLabel(), Attributes.RS_ALGORITHM_PROPERTY.getHelpText(), Attributes.RS_ALGORITHM_PROPERTY.getType(), Attributes.RS_ALGORITHM_PROPERTY.getDefaultValue(), algorithms.toArray(String[]::new));