Enable TLS 1.2 in Android 4.4

后端 未结 2 1312
闹比i
闹比i 2020-12-30 11:49

I use Retrofit and OkHttp3 for making requests. I konw that in Android 4.4 TLS 1.1 and TLS 1.2 are not enabled by defult. So i\'m trying to enable them. But so far i had no

2条回答
  •  长发绾君心
    2020-12-30 12:33

    That error usually occurs when android falls back to SSLv3 from TLSv1. It is a bug in pre-lollipop devices.

    The solution is to remove SSLv3 using Android's security Provider.

    try this solution:

    private void updateAndroidSecurityProvider(Activity callingActivity) {
        try {
            ProviderInstaller.installIfNeeded(this);
        } catch (GooglePlayServicesRepairableException e) {
        GooglePlayServicesUtil.getErrorDialog(e.getConnectionStatusCode(), callingActivity, 0);
        } catch (GooglePlayServicesNotAvailableException e) {
            Log.e("SecurityException", "Google Play Services not available.");
        }
    }
    

提交回复
热议问题