在运行时为Android 4.0添加TLSv1.2支持 [英] Add TLSv1.2 support at runtime for Android 4.0

查看:66
本文介绍了在运行时为Android 4.0添加TLSv1.2支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我公司的一个API正在更新为使用TLSv1.1或更高版本.不幸的是,Android 4.0本身并不支持这些协议.

One of my company's APIs is being updated to use TLSv1.1 or higher. Unfortunately, Android 4.0 does not natively support those protocols.

我认为这是可能的;在4.0设备上使用Chrome浏览到 https://www.howsmyssl.com 表示它正在使用TLSv1.2.我已经看到了一些使用SSLSocket的建议(尤其是这个),但是这些建议在我的应用程序中无效.我还尝试使用 ProviderInstaller.installIfNeeded()以通过Google Play服务添加TLSv1.2;根据howsmyssl的说法,该设备仍在使用TLSv1.0.

I think it's possible; navigating to https://www.howsmyssl.com using Chrome on a 4.0 device shows that it's using TLSv1.2. I have seen some suggestions using SSLSocket (particularly this one), but they have not worked within my app. I also tried using ProviderInstaller.installIfNeeded() to add TLSv1.2 via Google Play Services; according to howsmyssl, the device was still using TLSv1.0.

是否可以在运行时为Android 4.0添加对TLSv1.2的支持?

Is there a way to add support for TLSv1.2 at runtime for Android 4.0?

推荐答案

在Android 4.1/ android-16 之前,Android本身未添加TLSv1.1或TLSv1.2支持.使用不依赖Android的 SSLSocket 的库,以便在较旧的Android版本上获得比TLSv1.0更高的版本.通过查看 SSLSocket .

Android itself did not add TLSv1.1 or TLSv1.2 support until Android 4.1/android-16 so you'll have to use a library that does not rely on Android's SSLSocket in order to get newer than TLSv1.0 on older Android releases. You can see what is officially supported by looking at the reference for SSLSocket.

NetCipher 库将提供配置了最佳配置的 HttpsURLConnection 实例适用于该Android版本的TLS设置,但是在低于Android 4.1的版本上仍然无法提供TLSv1.1或TLSv1.2.

The NetCipher library will provide HttpsURLConnection instances that are configured with the best possible TLS settings for that Android version, but that still won't give you TLSv1.1 or TLSv1.2 on older than Android 4.1.

这篇关于在运行时为Android 4.0添加TLSv1.2支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆