连接到https站点(服务器) [英] Connect to https Site(Server)

查看:135
本文介绍了连接到https站点(服务器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些java-app,我想建立一些https网站的连接,我怎么能这样做,使用URLConnection?我是否应该使用信任存储,当使用有效的证书颁发机构签署此站点的证书时?

I have some java-app, and i want to establish a connection to some https Site, how can i do this, using URLConnection? Should i use trust store, when certificate from this site was signed using a valid certificate authority?

推荐答案

是的。 URLConnection应该工作。例如,

Yes. URLConnection should work. For example,

        URL a = new URL("https://login.yahoo.com");
        conn = a.openConnection();
        InputStream is = conn.getInputStream();

JRE附带一个包含大多数CA证书的默认信任库。只要证书由其中一个签署,您就不需要做任何特殊的事情。

JRE comes with a default trust store with most of the CA certs. As long as the cert is signed by one of them, you don't need to do anything special.

这篇关于连接到https站点(服务器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆