Using StrongTrustManager from the OnionKit library
In this recipe, we are going to leverage the great work of the folks at the Guardian Project to enhance the validation of SSL connections made by our app. Specifically, we are going to make use of StrongTrustManager
.
Getting ready
OnionKit is distributed as an Android library project. Before we start this recipe, download the OnionKit library from the GitHub page (https://github.com/guardianproject/OnionKit).
Then, extract and add to your project as you would add any other Android library project.
How to do it...
Let's get started!
Integrating the
StrongTustManager
class couldn't be simpler. It is just a case of swapping out yourHttpClient
implementation. Hence, change the following code:public HttpResponse sampleRequest() throws Exception { HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("https://server.com/path?apikey=123"); HttpResponse response = httpclient.execute(httpget); return response;...