2
我有一个pfx证书文件。我可以用下面的代码成功加载到X509Certificate2
类:
var path = "mycert.pfx"
var password = "mypassword";
var certificate = new X509Certificate2(path, password);
对于一些原因,我想用.pem格式的,而不是二进制格式。所以,我已经将我“mycert.pfx”到“mycert.pem”使用下面的OpenSSL命令:
pkcs12 -in mycert.pfx -out mycert.pem -nodes
问题
我如何可以加载我的转换mycert.pem以类似的方式因为我成功加载了mycert.pfx?下面的代码给了我一个CryptographicException,说“找不到请求的对象。” (注意:这不是关于文件未找到的IO异常)
var path = "mycert.pem"
var password = "mypassword";
var certificate = new X509Certificate2(path, password);