datatheorem / TrustKit-Android

Easy SSL pinning validation and reporting for Android.
MIT License
588 stars 87 forks source link

OkHttp 2 support #19

Closed ocampoleandro closed 7 years ago

ocampoleandro commented 7 years ago

I am trying to integrate TrustKit with OkHttp 2 but I have not succeeded yet.

URL url = new URL("https:/url");
String serverHostname = url.getHost();

okHttpClient.setSslSocketFactory(TrustKit.getInstance().getSSLSocketFactory(serverHostname));

The problem is that the cert pinning is not happening.

May the fact that I am not passing TrustKit.getInstance().getTrustManager(serverHostname) as the second argument be the problem ?

jobot0 commented 7 years ago

Hello what do you mean by the cert pinning is not happening? Do you have the error message in the logs which tell you the pin verification failed or is it something else?