fix: 完全移除TLS和证书算法限制以支持旧版SQL Server
This commit is contained in:
parent
5837a240cd
commit
311771aca9
@ -25,18 +25,19 @@ public class ThirdPartyDbService {
|
||||
|
||||
private final ThirdPartyDbConfigMapper configMapper;
|
||||
|
||||
// 静态初始化块:移除 TLS 协议限制,以支持旧版 SQL Server
|
||||
// 静态初始化块:移除 TLS 和证书算法限制,以支持旧版 SQL Server
|
||||
static {
|
||||
try {
|
||||
// 移除 TLS 1.0 和 TLS 1.1 的禁用限制
|
||||
java.security.Security.setProperty("jdk.tls.disabledAlgorithms",
|
||||
"SSLv3, RC4, DES, MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL");
|
||||
// 完全移除 TLS 算法禁用限制
|
||||
java.security.Security.setProperty("jdk.tls.disabledAlgorithms", "");
|
||||
// 完全移除证书路径算法禁用限制(解决 Certificates do not conform to algorithm constraints 错误)
|
||||
java.security.Security.setProperty("jdk.certpath.disabledAlgorithms", "");
|
||||
// 设置允许的 TLS 协议
|
||||
System.setProperty("jdk.tls.client.protocols", "TLSv1,TLSv1.1,TLSv1.2");
|
||||
System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2");
|
||||
log.info("已移除 TLS 协议限制,支持 TLSv1/TLSv1.1/TLSv1.2");
|
||||
log.info("已移除 TLS 和证书算法限制,支持旧版 SQL Server 连接");
|
||||
} catch (Exception e) {
|
||||
log.warn("移除 TLS 限制失败: {}", e.getMessage());
|
||||
log.warn("移除算法限制失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user