mirror of
https://github.com/Fuzion24/JustTrustMe.git
synced 2026-05-12 01:25:23 +08:00
Fixed issue trying to hook TrustManagerImpl on older APIs
Older APIs do not have the TrustManagerImpl class, so this checks if that class is available before attempting to hook.
This commit is contained in:
@@ -204,18 +204,36 @@ public class Main implements IXposedHookLoadPackage {
|
||||
}
|
||||
});
|
||||
|
||||
/* external/conscrypt/src/platform/java/org/conscrypt/TrustManagerImpl.java#217 */
|
||||
/* public List<X509Certificate> checkServerTrusted(X509Certificate[] chain, String authType, String host) throws CertificateException */
|
||||
findAndHookMethod("com.android.org.conscrypt.TrustManagerImpl", lpparam.classLoader, "checkServerTrusted", X509Certificate[].class, String.class, String.class, new XC_MethodReplacement() {
|
||||
@Override
|
||||
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
|
||||
ArrayList<X509Certificate> list = new ArrayList<X509Certificate>();
|
||||
return list;
|
||||
}
|
||||
});
|
||||
/* Only for newer devices should we try to hook TrustManagerImpl */
|
||||
if (hasTrustManagerImpl()) {
|
||||
|
||||
/* external/conscrypt/src/platform/java/org/conscrypt/TrustManagerImpl.java#217 */
|
||||
/* public List<X509Certificate> checkServerTrusted(X509Certificate[] chain,
|
||||
String authType, String host) throws CertificateException */
|
||||
findAndHookMethod("com.android.org.conscrypt.TrustManagerImpl", lpparam.classLoader,
|
||||
"checkServerTrusted", X509Certificate[].class, String.class,
|
||||
String.class, new XC_MethodReplacement() {
|
||||
@Override
|
||||
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
|
||||
ArrayList<X509Certificate> list = new ArrayList<X509Certificate>();
|
||||
return list;
|
||||
}
|
||||
});
|
||||
}
|
||||
} // End Hooks
|
||||
|
||||
/* Helpers */
|
||||
// Check for TrustManagerImpl class
|
||||
public boolean hasTrustManagerImpl() {
|
||||
|
||||
try {
|
||||
Class.forName("com.android.org.conscrypt.TrustManagerImpl");
|
||||
} catch(ClassNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//Create a SingleClientConnManager that trusts everyone!
|
||||
public ClientConnectionManager getSCCM() {
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user