我正在尝试创建X509Certificate2实例。代码如下:
public X509Certificate2 Get509Certificate()
{
string certkey = "some cert key";
string privatekey = "some private key";
var cert = new X509Certificate2(Convert.FromBase64String(certkey));
AsymmetricCipherKeyPair keyPair;
using (TextReader reader = new StringReader(privatekey)) {
keyPair = (AsymmetricCipherKeyPair)new PemReader(reader).ReadObject();
}
cert.PrivateKey = DotNetUtilities.ToRSA(keyPair.Private as RsaPrivateCrtKeyParameters);
return cert;
}
当我在线下面打电话
new PemReader(reader).ReadObject()我得到null值。我无法弄清楚为什么它返回null。 我正在使用DotNetOpenAuth& BouncyCastle插件执行Oauth 1.0a。 我还在https://www.sslshopper.com/certificate-key-matcher.html验证了我的证书和私钥,并且它与
匹配