开发者

where to save and how to use a jks certificate in Android

开发者 https://www.devze.com 2023-04-12 17:02 出处:网络
Im using Jsoup to开发者_JAVA百科 pull in xml, and while i have it working in java using System.setProperty(\"javax.net.ssl.trustStore\", \"/Users/EK/web2.uconn.edu.jks\");

Im using Jsoup to开发者_JAVA百科 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.


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 a KeyStore and use that to initialize a SocketFactory, which you use to initialize the HttpClient.

0

精彩评论

暂无评论...
验证码 换一张
取 消