JWS 签名者不允许或不支持 ES256 算法:支持的算法:[ES384]

问题描述 投票:0回答:1

调用端点 http://localhost:8081/restClientJwt 时出现以下错误:“JWS 签名者不允许或不支持 ES256 算法:支持的算法:[ES384]”

操作系统:“Ubuntu 22.04.4 LTS”

Java: “openjdk 版本“21.0.3”2024-04-16 LTS OpenJDK 运行时环境 Corretto-21.0.3.9.1(内部版本 21.0.3+9-LTS) OpenJDK 64 位服务器 VM Corretto-21.0.3.9.1(构建 21.0.3+9-LTS,混合模式,共享)”

Javac: “openjdk 版本“21.0.3”2024-04-16 LTS OpenJDK 运行时环境 Corretto-21.0.3.9.1(内部版本 21.0.3+9-LTS) OpenJDK 64 位服务器 VM Corretto-21.0.3.9.1(构建 21.0.3+9-LTS,混合模式,共享)”

Maven 依赖项:spring-security-oauth2-jose 版本 6.3.1,nimbus-jose-jwt 版本 9.40。

代码存储库:https://github.com/cassiusvm/spring-security-oauth2-restclient-interceptor

Docker 镜像:quay.io/keycloak/keycloak:23.0.4.

spring-boot oauth-2.0 jose
1个回答
0
投票

我解决了这个问题:

    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();
}
© www.soinside.com 2019 - 2024. All rights reserved.