I need to create an Https connection with a remote server then retrieve and verify the certificate.
I have established the connection fine:
try {
Quick googling brought me to this example using BouncyCastle. I think it better answers the question. http://www.nakov.com/blog/2009/12/01/x509-certificate-validation-in-java-build-and-verify-chain-and-verify-clr-with-bouncy-castle/