读取.der文件私钥C#

Read .der file private key C#

string LoadPrivateKey = "test.der";

X509Certificate2 x509 = new X509Certificate2(LoadPrivateKey, "test");

总是显示"unknown object in factory: DerInteger\r\nParameter name: obj"

我想在椭圆曲线密码学中使用

如何解决?

谢谢!

我终于解决了这个问题

  1. 使用 .pfx 包含私钥。

2.

X509Certificate2 cert = new X509Certificate2("test.pfx", "test");
                ECDsa mECDsa = cert.GetECDsaPrivateKey();
                Console.WriteLine("[ECDsa]: "+  mECDsa.KeySize);