Skip to content

Commit

Permalink
[native] Add support for TLS 1.2 for Android 4
Browse files Browse the repository at this point in the history
Summary:
When I updated the server to Ubuntu 20, this switched us over to [requiring TLS 1.2](https://discourse.ubuntu.com/t/default-to-tls-v1-2-in-all-tls-libraries-in-20-04-lts/12464).

However, Android 4 doesn't have support for TLS 1.2, which means we weren't able to connect to the server.

Luckily, [there's a way](facebook/react-native#23984) to use a third-party lib for TLS 1.2 (and TLS 1.3) support in React Native.

Test Plan: Make sure Android 4.4 client can connect to server

Reviewers: palys-swm

Reviewed By: palys-swm

Subscribers: KatPo, zrebcu411, Adrian

Differential Revision: https://phabricator.ashoat.com/D333
  • Loading branch information
Ashoat committed Oct 28, 2020
1 parent f9ce08e commit 5d7a6f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions native/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ dependencies {
implementation 'com.facebook.fresco:animated-webp:2.2.0'
implementation 'com.facebook.fresco:webpsupport:2.2.0'

implementation 'org.conscrypt:conscrypt-android:2.0.0'

if (enableHermes) {
def hermesPath = "../../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Arrays;
import java.util.List;
import java.lang.reflect.InvocationTargetException;
import java.security.Security;

public class MainApplication extends MultiDexApplication implements ReactApplication {
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), null);
Expand Down Expand Up @@ -67,6 +68,7 @@ public ReactNativeHost getReactNativeHost() {
@Override
public void onCreate() {
super.onCreate();
Security.insertProviderAt(new org.conscrypt.OpenSSLProvider(), 1);
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
Expand Down

0 comments on commit 5d7a6f8

Please # to comment.