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!

  1. Integrating the StrongTustManager class couldn't be simpler. It is just a case of swapping out your HttpClient implementation. Hence, change the following code:
    public HttpResponse ...

Get Android Security Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.