带有自签名 SSL 证书问题的 HTTPS... 解决方案或更好的方法? [英] HTTPS with Self-Signed SSL Certificate Issues... Solution or better way?
问题描述
我需要做的就是从具有自签名 SSL 证书的 Web 服务器下载一些基于文本的基本文件和图像文件.
All I need to do is download some basic text-based and image files from a web server that has a self-signed SSL certificate.
我一直试图弄清楚如何使用 HttpClient 来做到这一点,但让 SSL 工作是一场噩梦,对于这样一个简单的任务来说似乎太麻烦了.
I have been trying to figure out how to use HttpClient to do this, but getting the SSL to work is a nightmare that seems to be way too much trouble for such a simple task.
是否有更好的方法来执行这些文件下载?也许通过 WebView 或浏览器功能?重新发明一个简单的 HTTPS GET 请求是一个主要的痛苦,并且严重阻碍了我的开发计划.
Is there a better way to perform these file downloads? Perhaps through a WebView or Browser feature? Reinventing the wheel of making a simple HTTPS GET request is a major pain, and is significantly holding up my development schedule.
推荐答案
我找到了两个关于如何接受自签名 SSL 证书的很好的例子,一个分别用于 HttpsURLConnection 和 HttpClient.
I found two great examples of how to accept self-signed SSL certificates, one each for HttpsURLConnection and HttpClient.
HttpsURLConnection 解决方案: Https Connection Android
HttpClient 解决方案: Android 上的自签名 SSL 接受一个>
这篇关于带有自签名 SSL 证书问题的 HTTPS... 解决方案或更好的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!