I am trying to connect to an application over SSL. When connecting through WL/Java then I get sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification
and I understand that this is because I don't have server's certificate installed in my WL/Java's trusted store.
I imported the certificate from browser, installed it using keytool
and now everything is working fine.
However, below are few unresolved questions:
When I used
openssl s_client
command to connect with same host:port then the SSL handshake was successful. And this was before I added that certificate to my trusted store.- Why SSL handshake was successful in case of
openssl
without adding the certificate in keystore?
- Why SSL handshake was successful in case of
Browser doesn't contain the certificate in its trusted CA store, it only contains the certificates of trusted CA, and then it matches whether the signer CA of the server's certificate is present in its trusted CA store or not. If yes then it authenticates the server.
- In case of server, why the server was not authenticated even though the server's certificate signer's (EnTrust) certificate was present in my keystore. Why I needed to import the server certificate in my keystore as opposed to browser where it was not required?
- Only the server's certificate's signing CA's certificate need to be present in the keystore or the server's actual certificate should be present?