读取.der文件私钥C#

问题描述 投票:-1回答:1
string LoadPrivateKey = "test.der";

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

它总是显示“工厂中的未知对象:DerInteger \ r \ n参数名称:obj”

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

如何解决?

谢谢!

c# .net .net-core cryptography private-key
1个回答
0
投票

最后我解决了这个问题。

  1. 使用.pfx包含私钥。

2。

X509Certificate2 cert = new X509Certificate2("test.pfx", "test");
                ECDsa mECDsa = cert.GetECDsaPrivateKey();
                Console.WriteLine("[ECDsa]: "+  mECDsa.KeySize);
© www.soinside.com 2019 - 2024. All rights reserved.