Connection to https site (server)
I have a java application and I want to establish a connection to some https site, how can I do this using URLConnection? Should I use the trust store when the certificate from this site was signed using a valid CA?
+2
Le_Coeur
source
to share
1 answer
Yes. URLConnection should work. For example,
URL a = new URL("https://login.yahoo.com");
conn = a.openConnection();
InputStream is = conn.getInputStream();
The JRE comes with a default trust store with most CA certificates. As long as the certificate is signed by one of them, you don't need to do anything.
+5
ZZ Coder
source
to share