Skip to content
Advertisement

Unsafe implementation of the interface X509TrustManager – Google Play

When I try to upload an application to google play, I get a message. “Unsafe implementation of the interface x509trustmanager”. In a message from Google Play it says:

To avoid problems when validating the SSL certificate, change the code of the checkServerTrusted method in the X509TrustManager interface so that a CertificateException or IllegalArgumentException is thrown when it detects suspicious certificates.

All the options I’ve found use the checkValidity method to validate the certificate but Google also adds:

Do not use checkValidity to validate the server’s certificate. This method checks the validity of the certificate, not its security.

How can I change the code of the checkServerTrusted method correctly? My current implementation of x509TrustManager:

JavaScript

Advertisement

Answer

I changed the X509TrustManager implementation this way and the app passed Google Play verification:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement