We’re trying to verify the server cert while connecting to cloud sql via our java callout.
Works perfectly fine in non-prod cloud sql verification.
But throws the error “java.security.SignatureException: Signature does not match.” while trying to connect to Prod with setVerifyServerCertificate(true).
If we disable verifyServerCert, then it works fine in prod.
The server-ca.pem was downloaded from google cloud sql console and added to a truststore as
My apologies if i haven’t made that clear in my question. The truststore that i created is passed to the connection object. that’s how i mentioned it works for the non-prod env.
there is one root trusted certificate added to the runtime:
***
adding as trusted cert:
Subject: C=US, O="Google, Inc", CN=Google Cloud SQL Server CA
Issuer: C=US, O="Google, Inc", CN=Google Cloud SQL Server CA
Algorithm: RSA; Serial number: 0x0
Valid from Mon Mar 11 15:14:15 PDT 2019 until Thu Mar 08 14:15:15 PST 2029
And this is not the one that is in your .pem file
Issuer: CN=Google Cloud SQL Server CA, O=Google, Inc, C=US
Validity
Not Before: Feb 1 18:18:41 2019 GMT
Not After : Jan 29 18:19:41 2029 GMT
Subject: CN=Google Cloud SQL Server CA, O=Google, Inc, C=US
You can fetch your server certificate using command like this:
Can you validate your server certificate using openssl like this against your chain:
# no intermediate
openssl verify -CAfile ca-certs/rootca-crt.pem server-certs/traininglab-crt.pem
# with intermediate
openssl verify -CAfile ~/projects/sscerts/root/ca/intermediate/certs/ca-chain.cert.pem \
mockserversscert.crt
One more question, if it’s 1way, then you just need a single simple truststore with a single root certificate. I can see a key populated in your keystore. are you trying to set up a mtls? if not, what’s the key cert you’ve added to the keystore?