gpt4 book ai didi

java - Apache CXF 是否支持 TLS 1.2?

转载 作者:行者123 更新时间:2023-11-30 10:44:54 27 4
gpt4 key购买 nike

想知道apache cxf 3.1.6是否支持TLS1.2

我查看了Apache的文档,没有找到与TLS1.2相关的信息 http://cxf.apache.org/docs/tls-configuration.html

我还尝试将“secureSocketProtocol 设置为 TLSv2”,但最终在日志中出现“TLSv2 SSLContext 不可用”。

在这方面的任何帮助将不胜感激。

最佳答案

我在 Apache httpClient 中使用自定义 ssl 上下文在 Java 7 中打开 TLSv1.2(默认情况下未打开),因此您应该能够在 CXF 中打开它。在 Java 8 中,它应该默认使用它。我会尝试使用

TLSv1.2

如果您使用配置作为参数。

如果这不起作用,您可以尝试使用自定义 SSL 工厂。

// enable tls v1.1 and v1.2 on JRE 7

String jreVersion = System.getProperty("java.version");

if (jreVersion.startsWith("1.7")){

try {
SSLContext sslcontext = SSLContexts.custom().build();
// Allow TLSv1.1 and 1.2 protocol only
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext,
new String[] { "TLSv1.1", "TLSv1.2" }, null,
SSLConnectionSocketFactory.getDefaultHostnameVerifier());

customClient.setSSLSocketFactory(sslsf); // set the httpClient custom factory
} catch (KeyManagementException | NoSuchAlgorithmException e) {
e.printStackTrace();
throw e;
}
}

Getting CXF to use the custom socket factory 已回答on this SO question

关于java - Apache CXF 是否支持 TLS 1.2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37256729/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com