SSLContext.getInstance(" TLS")是否也支持TLS v1.1和TLS v1.2? [英] Will SSLContext.getInstance("TLS") supports TLS v1.1 and TLS v1.2 also?

查看:10538
本文介绍了SSLContext.getInstance(" TLS")是否也支持TLS v1.1和TLS v1.2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的java代码中,我使用命令创建一个SSL上下文实例

In my java Code i am creating one instance of SSL Context using command

SSLContext ctx = SSLContext.getInstance("TLS");

但是在我的tomcat服务器中我设置了TLSv1.2并且我收到了握手错误。

But in my tomcat server i am setting TLSv1.2 and i am getting handshake error.

我们如何使用这种方法支持所有TLS协议,就像在cpp中一样,我们有SSLV23客户端方法,它将支持所有协议。

How we can support all the TLS protocols using this method like in cpp we have SSLV23 client method which will support all protocols.

推荐答案

要使用TLSv1.2,请尝试使用以下代码:

To use TLSv1.2 try to use below code:

SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(null, null, null);

这篇关于SSLContext.getInstance(" TLS")是否也支持TLS v1.1和TLS v1.2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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