Issue
I would like to parse JSON which is secured with SSL (https), and on Android 2.x I obtain: "No Peer Certificate Exception", and I don't know (almost) anything about certificates, can somebody explain how to step by step how to integrate SSL certificate to my app and use it (which I understand I had to). Thats my current code:
HttpGet httppost = new HttpGet(url);
httppost.setHeader("Content-type", "application/json");
response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
inputStream = entity.getContent();
Solution
The exception means that the device does not trust the certificate of your server. If the used server certificate is a paid one (bought by a trustcenter) this means that the trustcenter certificate is not present on that device.
You can add the trustcenter certificate (or a self-signed certificate) into your app by placing it into a BouncyCastle Keystore (BKS)
Note that the latest versions of BouncyCastle produce by default a BKS file of a newer version that can not be read by Android. You need BouncyCastle 1.46.
See also: http://randomizedsort.blogspot.de/2010/09/step-to-step-guide-to-programming.html
Answered By - Robert
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.