Java SSLContext.getInstance("TLS") 是否也支持 TLS v1.1 和 TLS v1.2?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29841610/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Will SSLContext.getInstance("TLS") supports TLS v1.1 and TLS v1.2 also?
提问by mahan07
In my java Code i am creating one instance of SSL Context using command
在我的 Java 代码中,我正在使用命令创建 SSL 上下文的一个实例
SSLContext ctx = SSLContext.getInstance("TLS");
But in my tomcat server i am setting TLSv1.2 and i am getting handshake error.
但是在我的 tomcat 服务器中,我正在设置 TLSv1.2 并且出现握手错误。
How we can support all the TLS protocols using this method like in cpp we have SSLV23 client method which will support all protocols.
我们如何使用这种方法支持所有 TLS 协议,就像在 cpp 中一样,我们有 SSLV23 客户端方法,它将支持所有协议。
采纳答案by Rahim Rahimov
To use TLSv1.2 try to use below code:
要使用 TLSv1.2,请尝试使用以下代码:
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(null, null, null);