【发布时间】:2014-06-18 13:02:57
【问题描述】:
我正在使用不受信任的证书关注 android 的 https 教程。见here。
他们提供了 CA 不受信任时的场景示例代码。我的服务器上有自签名证书的场景。所以我不知道我在他们的示例代码中用什么替换了以下内容:
InputStream caInput = new BufferedInputStream(new FileInputStream("load-der.crt"));
// I can't figure out where to get my crt from ?
// I don't have access to that path directly from a URL
对于自签名证书,他们说:
You can create your own TrustManager, this time trusting
the server certificate directly.
我是否已单独获取服务器的自签名证书? API 会不会以某种方式自动为我获取这些信息?
【问题讨论】: