Android在OKHttp启用TLSv1.2工作 [英] Android Enable TLSv1.2 in OKHttp

查看:4214
本文介绍了Android在OKHttp启用TLSv1.2工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用OKHttp我的项目。我想启用TLSv1.2工作对我的服务呼叫。任何机构可以告诉我如何启用它。

i am using OKHttp for my project. i want to enable TLSv1.2 for my service call. can any body tell me how to enable it.

推荐答案

据我所知OKHttp不包括自己的SSL / TLS库,因此它只是使用由Android提供的标准的SSLSocket。

As far as I know OKHttp does not include own SSL/TLS libraries, therefore it just uses the standard SSLSocket provided by Android.

什么TLS版本支持(并启用)取决于所使用的Andr​​oid版本。
在一些手机TLS 1.2支持,但默认不启用。在这种情况下,你可以通过实施内部使用默认的自定义包装SSLSocketFactory的启用它的SSLSocketFactory和每一个Socket调用 setEnabledProtocols(新的String {TLS1.2})的被创建。

What TLS versions are supported (and enabled) depends on the used Android version. On some phone TLS 1.2 is supported but not enabled by default. In such cases you could enable it by implementing a custom wrapper SSLSocketFactory that uses internally the default SSLSocketFactory and calls setEnabledProtocols(new String{"TLS1.2"}) on every Socket that is created.

这篇关于Android在OKHttp启用TLSv1.2工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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