我正在使用Jython 2.latest而且我不能为我的生活找出如何安全地(即不关闭验证)下载HTTPS链接。
我似乎只能找到关闭验证的示例。
我正在使用像
这样的代码 thefile = urllib2.urlopen("https://example.com/index.php")
with open(save_path, 'wb') as output:
output.write(thefile.read())
logging.info("Successfully downloaded %s", save_path)
但我得到握手错误,完全可以预料。
所以我已经生成了ssl证书:
openssl s_client -showcerts -connect example.com:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >example.pem
所以现在我有了PEM文件。现在我该怎么办,有人知道吗?我是不是将PEM文件安装到密钥库中?
此处链接:Problem with Jython urllib2.urlopen for HTTPS pages表示您只能将其添加到java密钥库。