Enabling specific SSL protocols with Android WebViewClient

后端 未结 4 2080
孤街浪徒
孤街浪徒 2020-11-30 02:17

My application uses WebViewClient to make SSL connections to the server. The server is configured to only accept TLSv1.1 and above protocols.

1) How do I check which

4条回答
  •  暖寄归人
    2020-11-30 03:19

    If your app is using, or you are willing to use, Google Play services, you can use newer security features on older phones by installing their Provider. It is easy to install, only one line (plus exception handling, etc). You will also need to add google play services to your gradle file if you do not already have it. ProviderInstaller is included in the -base package.

    try {
        ProviderInstaller.installIfNeeded(this);
    } catch (GooglePlayServicesRepairableException e) {
         // Fix it
    } catch (GooglePlayServicesNotAvailableException e) {
         // Skip it
    }
    

    For a full example, see "Updating Your Security Provider to Protect Against SSL Exploits" from Google.

提交回复
热议问题