I am working in Java with Apache HTTPClient and trying to connect to graph.facebook.com. I am getting "SSLPeerUnverifiedException: no peer certificate" errors, so I think Facebook CA is not in the default keystore. So I need to create my own keystore with all the certificates I want to trust, right? Therefore, to obtain the certificate, I found the following command:
echo | openssl s_client -connect graph.facebook.com:443 2>&1 | \ sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > mycert.pem
I don’t know what is going on there, but it seems to have worked. I added the certificate to the Bouncy Castle Fortified Storage. I created SSLSocketFactory using the new keystore, but it still does not work.
My first guess was, maybe I do not have all the certificates in the chain (apparently these things are in the chain). So, how do I know if there are so-called “intermediate” CAs? And how can I get these certificates? Am I even on the right track?
Neil traft
source share