在 Android 中保存 jks 证书的位置以及如何使用
我使用 Jsoup 来提取 xml,虽然我让它在 java 中工作,但使用
System.setProperty("javax.net.ssl.trustStore", "/Users/EK/web2.uconn.edu.jks");
此代码在 Android 中不起作用。我知道我需要将证书存储在 android 项目中的某个位置,但是我将在哪里保存它/如何引用它?如果其他人知道在没有 jsoup 的情况下建立 ssl 连接的不同方法也很好。
Im using Jsoup to pull in xml, and while i have it working in java using
System.setProperty("javax.net.ssl.trustStore", "/Users/EK/web2.uconn.edu.jks");
this code wont work in Android. I know i need to store the certificate somewhere in the android project, but where would i save it/how would i reference it? If someone else knows a different way to establish an ssl connection without jsoup that is fine as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
HttpClient
获取 HTTP 内容。如果您需要自定义信任存储,可以将其存储为原始资产,将其加载到KeyStore
中并使用它来初始化 SocketFactory,用于初始化HttpClient
。You can use
HttpClient
to get HTTP content. If you need a custom trust store, you can store it as a raw asset, load it into aKeyStore
and use that to initialize a SocketFactory, which you use to initialize theHttpClient
.