#53331·keycloak

[OID4VCI] exclude a self-signed trust anchor from signed issuer metadata x5c

Author: OgenbertrandCreated Sep 30, 2026Updated Sep 30, 2026
Labelskind/task

Description

Description

When Keycloak generates signed OID4VCI issuer metadata, it copies the complete certificate chain returned by the configured key provider into the JWT x5c header.

This is problematic with the Java keystore provider: a full chain including the self-signed root may be required for Keycloak to load and validate the signing certificate, but the same root is then published as part of the signed issuer metadata.

Reproduction

  1. Configure an ES256 Java keystore key provider with an access certificate and its self-signed root certificate.
  2. Set oid4vci.signed_metadata.alg to ES256.
  3. Request issuer metadata with Accept: application/jwt.
  4. Inspect the JWT protected header.

The resulting metadata JWT is correctly signed, but x5c contains both the access certificate and the self-signed root.

Using a real German EUDI sandbox access certificate, a leaf-only PKCS#12 keystore failed with:

Certificate error on server. Path does not chain with any of the trust anchors