WindowsCryptographicException: Keyset does not exist

若如初见. 提交于 2019-12-03 17:19:58

I followed that blog post too and also had that issue. The problem was when you run this to create PKCS12 file:

openssl pkcs12 -export -out example.pfx -inkey example.key -in example.crt -certfile example.crt

Try to remove -certfile example.crt and it should work.

Also according to .NET Core X509Certificate2 usage (under Windows/IIS, Docker, Linux) you can test if certificate was loaded from file correctly by accessing cert.PrivateKey. E.g.

X509Certificate2 cert = new X509Certificate2(Path.Combine(Directory.GetCurrentDirectory(), "cert.pfx"), "password");
Console.WriteLine("cert private key: " + cert.PrivateKey);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!