Hello!
We have been using Keycloak for two years now successfully, but it is time to replace our expiring certificate/key used for SAML encryption/decryption and we are running into issues.
Our customers each have their own realm set up with a configured SAML 2.0 Identity Provider.
Unless they are using Azure, we have historically recommended that they encrypt their SAML assertions with our public certificate.
To this point, we have just made sure that each realm has our RSA key in place with the public cert/private key combination set to active with a priority of 200 and decryption has never been a problem.
However, we were expecting that we could add our new RSA certificate/key combination in each realm at a higher priority (205) than the existing key and Keycloak would attempt to decrypt with the higher priority one and, if not successful, then attempt to decrypt with the other.
This has not been successful in any test so far.
We are only ever able to log in successfully (without a decryption error) if the (SAML 2.0) Identity Provider’s encryption certificate is the same as the certificate tied to the highest active key in the realm.
If the keys are set to the same priority and both active, it will only be able to decrypt with the key shown first in the UI (Realm Settings → Keys) list.
All documentation we can find seems to be around rotation for signing keys, not keys used for encryption/decryption.
As of now, it appears that there is no way to support two decryption options for a SAML configuration without going realm by realm and updating in coordination with the client updating their (SAML 2.0) IdP’s encryption certificate.
We’ve tried every combination of priority/passive/KeyUse (including adding each key twice and setting one to SIG and one to ENC) that we can think of, but it sounds like this may only be supported for OIDC configurations and not SAML?
Is there something we’re missing? Both keys show up in the (SAML 2.0) IdP metadata link with use="encryption"
set, but the second one will never work to successfully decrypt the SAML assertion. This is repeatable 100% of the time.
We have tried this in version 16.1.1 as well as 12.0.4