忽略私钥

This commit is contained in:
wangjie 2025-07-26 00:15:24 +08:00
parent b1ec70887e
commit eea1bbc18c

View File

@ -90,16 +90,17 @@ func InitDB(env string, conf DbConfig) {
panic("添加CA证书到池失败")
}
//// 3. 加载客户端证书和私钥
//cert, err := tls.LoadX509KeyPair("path/to/client-cert.pem", "path/to/client-key.pem")
//if err != nil {
// panic("加载客户端证书失败: " + err.Error())
//}
/* // 3. 加载客户端证书和私钥
cert, err := tls.LoadX509KeyPair("path/to/client-cert.pem", "path/to/client-key.pem")
if err != nil {
panic("加载客户端证书失败: " + err.Error())
}*/
// 4. 创建TLS配置
tlsConfig := &tls.Config{
RootCAs: caCertPool, // 信任的CA
//Certificates: []tls.Certificate{cert}, // 客户端证书
ServerName: conf.Host,
MinVersion: tls.VersionTLS12, // 最小TLS版本
}