.NET使用BouncyCastle从Windows应用商店读取ECC证书

时间:2014-05-19 09:55:12

标签: c# .net bouncycastle elliptic-curve

我使用OpenSSL生成了一些ECC证书。我可以在Windows商店中看到这些证书。

我想要做的是加载ECC证书,获取其私钥,使用其他加密方法的公钥,如:

    X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
    store.Open(OpenFlags.ReadWrite | OpenFlags.OpenExistingOnly);
    X509Certificate2Collection x509Certificate2Collection = 
        store.Certificates.Find(X509FindType.FindBySerialNumber, "008B2D89B2A75EE891", false);

    X509Certificate2 cert= x509Certificate2Collection[0];
    (use Bouncy Castle to read it here)

我也尝试:

    var asymmetricCipherKeyPair = 
        DotNetUtilities.GetKeyPair(x509Certificate2.PrivateKey);

但是这给出了一个例外:

    {"The certificate key algorithm is not supported."} System.Exception {System.NotSupportedException}

0 个答案:

没有答案