-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Closed
Labels
BugPlatform: AndroidAndroid applications.Android applications.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
Description
Correctly functioning behaviour.
In Android v5 and upwards when using the standard OkHttpClientProvider it uses OkHttpClient.Builder() to determine the connectionSpecs. This returns a default
DEFAULT_CONNECTION_SPECS = Util.immutableList(
ConnectionSpec.MODERN_TLS, ConnectionSpec.COMPATIBLE_TLS, ConnectionSpec.CLEARTEXT);
Inconsistent behaviour
For Android SDK Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT
it goes into a custom enableTls12OnPreLollipop
codeblock that specifically only implements ConnectionSpec.MODERN_TLS
This results that connections using TLSv1 will not work on Android 4.
Reproduction Steps and Sample Code
- Run an emulator on API 16.
- Try a SSL network request to a SSL server only accepting TLSv1
- Fail network request due to the following error
javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb9561090: Failure in SSL library, usually a protocol error
error:14077102:SSL routines:SSL23_GET_SERVER_HELLO:unsupported protocol (external/openssl/ssl/s23_clnt.c:714 0x9e0fd925:0x00000000)
Solution
Will Add pull request.
Added #14245
in com.facebook.react.modules.network.TLSSocketFactory replace
private Socket enableTLSOnSocket(Socket socket) {
if(socket != null && (socket instanceof SSLSocket)) {
((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"});
}
return socket;
}
with
private Socket enableTLSOnSocket(Socket socket) {
if(socket != null && (socket instanceof SSLSocket)) {
((SSLSocket)socket).setEnabledProtocols(new String[] {"TLSv1","TLSv1.1", "TLSv1.2"});
}
return socket;
}
Additional Information
- React Native version: v0.45.0-rc.2
- Platform: Android
- Development Operating System: OSX and Windows
- Dev tools: Android Studio version, Android SDK 25
nimamoradi, asrori7, strong0588 and h2soheili
Metadata
Metadata
Assignees
Labels
BugPlatform: AndroidAndroid applications.Android applications.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.