Repository navigation
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
Reacted by Nima Moradi, Rori, Eric Ling and Hamed Soheili
Metadata
Metadata
Assignees
Labels
BugPlatform: AndroidAndroid applications.Android applications.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Activity
hramos commentedon Jul 31, 2017
Adding TLSv1 support for custom SSL socket factory
8of commentedon Jul 24, 2018
Reoccured on React Native
0.56.0sijad commentedon Sep 10, 2018
any news on this one? we can't use cloudflare CDN because of this bug.
stale commentedon Dec 9, 2018
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.
sijad commentedon Dec 9, 2018
I think this should kept open
lahed commentedon Dec 12, 2018
Some solution, the same thing happens to me, since 0.56.0 it stopped working
ThaJay commentedon Feb 28, 2019
This is the original pull request
#9840
Original issue:
#7192
dulmandakh commentedon Mar 19, 2019
we fixed the issue in the master, and will be included in future releases. 75af15e
dulmandakh commentedon Mar 19, 2019
please see #23984 for workarounds