如何在 Java 中为 https 配置 SSL 密码套件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19228452/
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
How to configure SSL Cipher Suites for https in Java
提问by twizansk
I am using a third-party package for managing OAuth connections. I would like to configure the cipher suites used by the SSL connection under the hood. Unfortunately, the third party creates the connection with URL.openConnection()
and I have no obvious way to reach the SSLSocketFactory in order to set the cipher suites. Is there a way to set this through, for example, a JVM parameter?
我正在使用第三方包来管理 OAuth 连接。我想在后台配置 SSL 连接使用的密码套件。不幸的是,第三方创建了连接,URL.openConnection()
我没有明显的方法来访问 SSLSocketFactory 以设置密码套件。有没有办法通过例如 JVM 参数来设置它?
Thanks
谢谢
回答by Bruno
URL.openConnection()
(with an https://
URL) should use an HttpsURLConnection
. You should be able to use the https.cipherSuites
system property for this. (See table in the customization section of the JSSE ref. guide).
URL.openConnection()
(带有https://
URL)应该使用HttpsURLConnection
. 您应该能够为此使用https.cipherSuites
系统属性。(请参阅JSSE 参考指南的定制部分中的表格)。