Skip to content

Certificate Management

Orhan Obut edited this page Aug 15, 2015 · 4 revisions

You can make use of this feature in two ways:

  • Trust All Certificates: Most of the time test servers do not use a certificate which is signed by a CA. Therefore, connections to those servers fail at SSL Handshake step. To solve this, you can let Wasp to accept all certificates (Note that, this should only be used for testing purposes because it makes the connections vulnerable to security attacks.)
GitHubService service = new Wasp.Builder(this)    
  .setEndpoint("https://api.github.com")   
  .trustCertificates()  //Trust All Certificates
  .build()                        
  .create(MyService.class);
  • Certificate Pinning: Create a BKS file of your server certificate and put it under res/raw folder. Than, let Wasp use your certificate for SSL Handshake with the server by providing your raw resource id and keystore pasword.
GitHubService service = new Wasp.Builder(this)    
 .setEndpoint("https://api.github.com")   
 .trustCertificates(R.raw.YOUR_TRUST_STORE, "YOUR_PASSWORD") //Trust only to the given certificates
 .build()                        
 .create(MyService.class);
Clone this wiki locally