Sectigo Certificate chain rejected because End entity was signed with SHA1withRSA but my certificate was signed with sha256WithRSAEncryption #1998
Replies: 6 comments
-
Please mention all BC jar versions as well as the Java runtime version. It's not possible to completely replicate the checks outside of the TLS context, but we can infer that the A BCJSSE If a BCJSSE
That is the situation here as indicated by It would help if you could set a breakpoint in EDIT: One more thing; based on the title and other hints, possibly you are adding your chain in the wrong order for JSSE. The "right" order is the reverse of their appearance in the Sectigo-Chain.txt file. |
Beta Was this translation helpful? Give feedback.
-
Here are the versions of the BC jars, straight from my Dockerfile
Keycloak 26.1.0 comes with OpenJDK version 21. |
Beta Was this translation helpful? Give feedback.
-
I've updated the certificate chain to reverse the order but I'm still facing the same issue. Attached is the updated certificate chain. |
Beta Was this translation helpful? Give feedback.
-
Are you sure it's exactly the same exception? If you reversed the chain I would guess the exception message shortened to just "Signature algorithm 'SHA1WITHRSA' not permitted with given parameters". That would confirm that the code was unable to determine the trusted certs per my guess above. |
Beta Was this translation helpful? Give feedback.
-
You are correct. The message was shortened.
Attached is the entire log file. |
Beta Was this translation helpful? Give feedback.
-
@ghettosamson It occurs to me that you shouldn't be including the SHA1withRSA root certificate in the chain that you deployed to postgres (just remove it from that chain). It is unnecessary (and unusual) in TLS to have the root cert in the sent chain because any TLS peer would have to already have the root certificate (or some intermediate CA) in a trust store somewhere to be able to verify the chain anyway. (There is a special case when a single self-signed certificate IS the chain). To be clear, the BCJSSE TrustManager could tolerate it being there but not when it has to work with the third-party wrapper that doesn't support X509ExtendedTrustManager. |
Beta Was this translation helpful? Give feedback.
-
Versions: Keycloak 26.1.0 in Docker and Postgres 16.6-alpine3.20. I am using BouncyCastle for my Keycloak in FIPS mode. My expiring certificate was signed by Entrust and I did not experience this issue. I have a new certificate signed by Sectigo with sha256WithRSAEncryption. I deploy my Postgres with my private key and certificate with chain. When I start my keycloak container and it attempts to connect to Postgres, I get the following error.
Attached find the Sectigo certificate chain.
Sectigo-Chain.txt
Is this a bug? If not, is there a way to tell BC to allow this? I've tried several things like removing the chain from the certificate, but Keycloak then complains that the certificate needs the chain. The way I am specifying the private key and the certificate in Keycloak is via the following environment variables,
KC_HTTPS_CERTIFICATE_KEY_FILE
andKC_HTTPS_CERTIFICATE_FILE
and thats all I am providing. I also tried addingKC_TRUSTSTORE_PATHS
but that didn't help.Beta Was this translation helpful? Give feedback.
All reactions