Volley Android HTTPS self signed certificate

If you need to use a self signed certificate for your Android application using the framevork Volley and you receive  exceptions like

  • java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
  • javax.net.ssl.SSLPeerUnverifiedException: Hostname [hostname] not verified

you need to configure a TrustManager and a custom HostnameVerifier.  The following code is a working Activity that implement the main configuration of the two.

First you need to put your self signed certificate in the folder res/raw es. res/raw/server.crt

Precedente Xubuntu Dropbox icona mancante Successivo Anatomia di una TRUFFA