1

I have applied the following code to verify the SSL certificate off the server and run the application using the HTTPS secure connection. My server is already having a certificate issued by an authorized CA's.

Following is the snippet of my code implemented..

CertificateFactory cf = CertificateFactory.getInstance("X.509");
InputStream caInput = getResources().openRawResource(R.raw.certificate)
Certificate ca;
try {    
ca = cf.generateCertificate(caInput);
System.out.println("ca=" + ((X509Certificate) ca).getSubjectDN());
} finally {
caInput.close();
}
String keyStoreType = KeyStore.getDefaultType();
KeyStore keyStore = KeyStore.getInstance(keyStoreType);
keyStore.load(null, null);
keyStore.setCertificateEntry("ca", ca);
String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm);
tmf.init(keyStore);
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, tmf.getTrustManagers(), null);
URL url = new URL(webserviceurl); 
HttpsURLConnection urlConnection=                          
urlConnection.setSSLSocketFactory(context.getSocketFactory());
InputStream in = urlConnection.getInputStream();

Warning received in PlayStore

"Your app is using an unsafe implementation of the X509TrustManager interface with an Apache HTTP client, resulting in a security vulnerability. Please see this Google Help Center article for details, including the deadline for fixing the vulnerability."

Previously, I have also tried using TRUST MANAGER x509, But resulted in the same warning.. Can anyone help me to get out of this warning from playstore?

rs shah
  • 11
  • 3
  • Just a friendly tip, you may want to read over this page: [The How-To-Ask Guide](https://stackoverflow.com/help/how-to-ask) so you can always be sure that your questions are easily answerable and as clear as possible. Be sure to include any efforts you've made to fix the problem you're having, and what happened when you attempted those fixes. Also don't forget to your show code and any error messages! – Matt C Apr 13 '16 at 04:11
  • 1
    Thanks for you suggestions and guidance, Now I have edited my question and added proper and all requried information.Sorry for the inconvenience caused.... – rs shah Apr 13 '16 at 05:06

0 Answers0