【发布时间】:2021-06-02 13:56:54
【问题描述】:
通常,当我从我的密钥库中获取X509Certificate2 时,我可以调用.PrivateKey 以将证书的私钥作为AsymmetricAlgorithm 检索。但是我决定使用 Bouncy Castle 并且它的 X509Certificate 实例只有一个 getPublicKey(); 我看不到从证书中获取私钥的方法。有什么想法吗?
我从我的 Windows-MY 密钥库中获得了 X509Certificate2,然后使用:
//mycert is an X509Certificate2 retrieved from Windows-MY Keystore
X509CertificateParser certParser = new X509CertificateParser();
X509Certificate privateCertBouncy = certParser.ReadCertificate(mycert.GetRawCertData());
AsymmetricKeyParameter pubKey = privateCertBouncy.GetPublicKey();
//how do i now get the private key to make a keypair?
有没有办法将AsymmetricAlgorithm(C# 私钥) 转换为AsymmetricKeyParameter(bouncycastle 私钥)?
【问题讨论】:
标签: c# x509certificate bouncycastle private-key