diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-09-21 14:06:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-21 14:06:55 +0200 |
commit | 4664d03a0e39be6dc8f5ba8154e1d6b776fa2293 (patch) | |
tree | 90fbfa1b7d263bb4be7d47800f90254fed2495f7 /platform/android | |
parent | a1779c90448e2d86b81812c45814983d142ae9b4 (diff) | |
parent | 1a704d76769b1d986d959984f666953ccbd8faf3 (diff) |
Merge pull request #11458 from volzhs/fix-trustmanager-master
Fix TrustManager for Android
[ci skip]
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java index c9532a5d01..3fc8c48397 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java +++ b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java @@ -36,12 +36,9 @@ import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; +import javax.net.ssl.TrustManagerFactory; import org.apache.http.conn.ssl.SSLSocketFactory; @@ -56,19 +53,10 @@ public class CustomSSLSocketFactory extends SSLSocketFactory { public CustomSSLSocketFactory(KeyStore truststore) throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { super(truststore); - TrustManager tm = new X509TrustManager() { - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { - } + TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509"); + tmf.init(truststore); - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { - } - - public X509Certificate[] getAcceptedIssuers() { - return null; - } - }; - - sslContext.init(null, new TrustManager[] { tm }, null); + sslContext.init(null, tmf.getTrustManagers(), null); } @Override |