Reputation: 139
The following error occurs when calling the endpoint http://localhost:8081/restClientJwt: "The ES256 algorithm is not allowed or supported by the JWS signer: Supported algorithms: [ES384]"
O.S.: "Ubuntu 22.04.4 LTS"
Java: "openjdk version "21.0.3" 2024-04-16 LTS OpenJDK Runtime Environment Corretto-21.0.3.9.1 (build 21.0.3+9-LTS) OpenJDK 64-Bit Server VM Corretto-21.0.3.9.1 (build 21.0.3+9-LTS, mixed mode, sharing)"
Javac: "openjdk version "21.0.3" 2024-04-16 LTS OpenJDK Runtime Environment Corretto-21.0.3.9.1 (build 21.0.3+9-LTS) OpenJDK 64-Bit Server VM Corretto-21.0.3.9.1 (build 21.0.3+9-LTS, mixed mode, sharing)"
Maven dependencies: spring-security-oauth2-jose version 6.3.1, nimbus-jose-jwt version 9.40.
Code repository: https://github.com/cassiusvm/spring-security-oauth2-restclient-interceptor
Docker Image: quay.io/keycloak/keycloak:23.0.4.
Upvotes: 0
Views: 151
Reputation: 139
I solved the issue:
private static KeyPair generateEcKey() {
Security.setProperty("crypto.policy", "unlimited");
BouncyCastleProvider bouncyCastleProvider = new BouncyCastleProvider();
Security.addProvider(bouncyCastleProvider);
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("EC", bouncyCastleProvider.getName());
keyPairGenerator.initialize(new ECGenParameterSpec("secp256r1"));
return keyPairGenerator.generateKeyPair();
}
Upvotes: 0