Ward
Ward

Reputation: 2852

How can I inspect a HTTPS certificate before making a connection

I'm trying, in java, to connect to a HTTPS endpoint. The server's certificate is signed by an internal CA. (not included in the truststore). Because of that, connection fails as expected

How can I inspect a certificate from a https server before the connection is made (in java). I need to view it to know what CA certificate I need to import.

I can do this using openssl like so openssl s_client -connect www.paypal.com:443

But I would like to do this from Java

Thanks!

Upvotes: 0

Views: 402

Answers (1)

Neroon
Neroon

Reputation: 1379

You do a connection with disabled chain verfication. You could find an example there: http://www.nakov.com/blog/2009/07/16/disable-certificate-validation-in-java-ssl-connections/

After having the insecure connection you could inspect the certificate

Upvotes: 1

Related Questions