0
我试图用密码加载p12证书文件,我想知道在生产环境中存储和使用密码的最佳做法是什么。如何以及在哪里存储用于加载p12证书文件的密码
正在使用的代码是:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
var handler = new WebRequestHandler();
var certificate = new X509Certificate2Collection();
certificate.Import(@"D:\certificate.p12", "password", X509KeyStorageFlags.DefaultKeySet);
handler.ClientCertificates.AddRange(certificate);
handler.ServerCertificateValidationCallback = ValidateServerCertificate;
var client = new HttpClient(handler)
{
BaseAddress = new Uri(chargeCodeServer)
};
正在使用的密码是以下行:
certificate.Import(@"D:\certificate.p12", "password", X509KeyStorageFlags.DefaultKeySet);
我们部署使用的TeamCity,章鱼和使用PowerShell脚本。请让我知道是否有其他需要。