Loading core/java/android/net/SSLCertificateSocketFactory.java +10 −7 Original line number Diff line number Diff line Loading @@ -23,8 +23,7 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.os.RoSystemProperties; import com.android.org.conscrypt.Conscrypt; import com.android.org.conscrypt.OpenSSLContextImpl; import com.android.org.conscrypt.ClientSessionContext; import com.android.org.conscrypt.OpenSSLSocketImpl; import com.android.org.conscrypt.SSLClientSessionCache; Loading @@ -33,6 +32,8 @@ import java.net.InetAddress; import java.net.Socket; import java.net.SocketException; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.PrivateKey; import java.security.cert.X509Certificate; Loading @@ -40,6 +41,7 @@ import javax.net.SocketFactory; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.KeyManager; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; Loading Loading @@ -251,11 +253,12 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { private SSLSocketFactory makeSocketFactory( KeyManager[] keyManagers, TrustManager[] trustManagers) { try { OpenSSLContextImpl sslContext = (OpenSSLContextImpl) Conscrypt.newPreferredSSLContextSpi(); sslContext.engineInit(keyManagers, trustManagers, null); sslContext.engineGetClientSessionContext().setPersistentCache(mSessionCache); return sslContext.engineGetSocketFactory(); } catch (KeyManagementException e) { SSLContext sslContext = SSLContext.getInstance("TLS", "AndroidOpenSSL"); sslContext.init(keyManagers, trustManagers, null); ((ClientSessionContext) sslContext.getClientSessionContext()) .setPersistentCache(mSessionCache); return sslContext.getSocketFactory(); } catch (KeyManagementException | NoSuchAlgorithmException | NoSuchProviderException e) { Log.wtf(TAG, e); return (SSLSocketFactory) SSLSocketFactory.getDefault(); // Fallback } Loading Loading
core/java/android/net/SSLCertificateSocketFactory.java +10 −7 Original line number Diff line number Diff line Loading @@ -23,8 +23,7 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.os.RoSystemProperties; import com.android.org.conscrypt.Conscrypt; import com.android.org.conscrypt.OpenSSLContextImpl; import com.android.org.conscrypt.ClientSessionContext; import com.android.org.conscrypt.OpenSSLSocketImpl; import com.android.org.conscrypt.SSLClientSessionCache; Loading @@ -33,6 +32,8 @@ import java.net.InetAddress; import java.net.Socket; import java.net.SocketException; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.PrivateKey; import java.security.cert.X509Certificate; Loading @@ -40,6 +41,7 @@ import javax.net.SocketFactory; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.KeyManager; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; Loading Loading @@ -251,11 +253,12 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { private SSLSocketFactory makeSocketFactory( KeyManager[] keyManagers, TrustManager[] trustManagers) { try { OpenSSLContextImpl sslContext = (OpenSSLContextImpl) Conscrypt.newPreferredSSLContextSpi(); sslContext.engineInit(keyManagers, trustManagers, null); sslContext.engineGetClientSessionContext().setPersistentCache(mSessionCache); return sslContext.engineGetSocketFactory(); } catch (KeyManagementException e) { SSLContext sslContext = SSLContext.getInstance("TLS", "AndroidOpenSSL"); sslContext.init(keyManagers, trustManagers, null); ((ClientSessionContext) sslContext.getClientSessionContext()) .setPersistentCache(mSessionCache); return sslContext.getSocketFactory(); } catch (KeyManagementException | NoSuchAlgorithmException | NoSuchProviderException e) { Log.wtf(TAG, e); return (SSLSocketFactory) SSLSocketFactory.getDefault(); // Fallback } Loading