|
2 | 2 |
|
3 | 3 | import android.content.Context;
|
4 | 4 | import android.net.http.SslError;
|
| 5 | +import android.net.http.X509TrustManagerExtensions; |
5 | 6 | import android.util.Log;
|
6 | 7 | import android.webkit.SslErrorHandler;
|
7 | 8 | import android.webkit.WebView;
|
|
34 | 35 | import javax.net.ssl.HostnameVerifier;
|
35 | 36 | import javax.net.ssl.KeyManager;
|
36 | 37 | import javax.net.ssl.SSLContext;
|
| 38 | +import javax.net.ssl.SSLParameters; |
37 | 39 | import javax.net.ssl.SSLSession;
|
38 | 40 | import javax.net.ssl.TrustManager;
|
39 | 41 | import javax.net.ssl.X509TrustManager;
|
@@ -102,6 +104,20 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
|
102 | 104 | }
|
103 | 105 | });
|
104 | 106 |
|
| 107 | + findAndHookMethod(X509TrustManagerExtensions.class, "checkServerTrusted", X509Certificate[].class, String.class, String.class, new XC_MethodReplacement() { |
| 108 | + @Override |
| 109 | + protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { |
| 110 | + return param.args[0]; |
| 111 | + } |
| 112 | + }); |
| 113 | + |
| 114 | + findAndHookMethod("android.security.net.config.NetworkSecurityTrustManager", lpparam.classLoader, "checkPins", List.class, new XC_MethodReplacement() { |
| 115 | + @Override |
| 116 | + protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { |
| 117 | + return null; |
| 118 | + } |
| 119 | + }); |
| 120 | + |
105 | 121 | /* external/apache-http/src/org/apache/http/conn/ssl/SSLSocketFactory.java */
|
106 | 122 | /* public SSLSocketFactory( ... ) */
|
107 | 123 | Log.d(TAG, "Hooking SSLSocketFactory(String, KeyStore, String, KeyStore) for: " + currentPackageName);
|
@@ -303,6 +319,23 @@ protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
|
303 | 319 | return list;
|
304 | 320 | }
|
305 | 321 | });
|
| 322 | + |
| 323 | + findAndHookMethod("com.android.org.conscrypt.TrustManagerImpl", lpparam.classLoader, "checkTrusted", X509Certificate[].class, String.class, SSLSession.class, SSLParameters.class, boolean.class, new XC_MethodReplacement() { |
| 324 | + @Override |
| 325 | + protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { |
| 326 | + ArrayList<X509Certificate> list = new ArrayList<X509Certificate>(); |
| 327 | + return list; |
| 328 | + } |
| 329 | + }); |
| 330 | + |
| 331 | + |
| 332 | + findAndHookMethod("com.android.org.conscrypt.TrustManagerImpl", lpparam.classLoader, "checkTrusted", X509Certificate[].class, byte[].class, byte[].class, String.class, String.class, boolean.class, new XC_MethodReplacement() { |
| 333 | + @Override |
| 334 | + protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { |
| 335 | + ArrayList<X509Certificate> list = new ArrayList<X509Certificate>(); |
| 336 | + return list; |
| 337 | + } |
| 338 | + }); |
306 | 339 | }
|
307 | 340 |
|
308 | 341 | } // End Hooks
|
@@ -556,10 +589,10 @@ public void checkClientTrusted(X509Certificate[] chain, String authType) throws
|
556 | 589 | public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
557 | 590 | }
|
558 | 591 |
|
559 |
| - public List<X509Certificate> checkServerTrusted(X509Certificate[] chain, String authType, String host) throws CertificateException { |
560 |
| - ArrayList<X509Certificate> list = new ArrayList<X509Certificate>(); |
561 |
| - return list; |
562 |
| - } |
| 592 | + public List<X509Certificate> checkServerTrusted(X509Certificate[] chain, String authType, String host) throws CertificateException { |
| 593 | + ArrayList<X509Certificate> list = new ArrayList<X509Certificate>(); |
| 594 | + return list; |
| 595 | + } |
563 | 596 |
|
564 | 597 | @Override
|
565 | 598 | public X509Certificate[] getAcceptedIssuers() {
|
|
0 commit comments