Fixes #4683 - uses X/Y instead of Gx/Gy for thumbprint of ecdsa keys

Signed-off-by: Guillaume Pelletier <guillaume.pelletier@genaiz.com>
This commit is contained in:
Guillaume pelletier 2025-08-05 14:44:56 -04:00 committed by Guillaume Pelletier
parent e7b4fa06f2
commit 6e59b82417

View File

@ -84,10 +84,9 @@ func getJWKThumbprint(publickey crypto.PublicKey, skipED25519 bool) string {
return hashAndEncode(fmt.Sprintf(`{"e":"%s","kty":"RSA","n":"%s"}`, e, n)) return hashAndEncode(fmt.Sprintf(`{"e":"%s","kty":"RSA","n":"%s"}`, e, n))
case *ecdsa.PublicKey: case *ecdsa.PublicKey:
params := pubkey.Params() crv := pubkey.Params().Name
crv := params.Name x := base64.RawURLEncoding.EncodeToString(pubkey.X.Bytes())
x := base64.RawURLEncoding.EncodeToString(params.Gx.Bytes()) y := base64.RawURLEncoding.EncodeToString(pubkey.Y.Bytes())
y := base64.RawURLEncoding.EncodeToString(params.Gy.Bytes())
return hashAndEncode(fmt.Sprintf(`{"crv":"%s","kty":"EC","x":"%s","y":"%s"}`, crv, x, y)) return hashAndEncode(fmt.Sprintf(`{"crv":"%s","kty":"EC","x":"%s","y":"%s"}`, crv, x, y))
case ed25519.PublicKey: case ed25519.PublicKey: