Create RSACryptoServiceProvider object using RSA private key file in C#

﹥>﹥吖頭↗ 提交于 2019-12-01 14:28:51

.NET has no built-in functionality for reading private keys (or public keys, for that matter) which are not associated with certificates.

Your easiest fix is to wrap the new RSA key in a self-signed cert, and then put both the cert and the private key into the .p12 file.

The alternatives are to manually parse the private key file/blob and build an RSAParameters structure; or to use a 3rd party library which can do that for you.

Since your P12 file does not contain an X509 Certificate, X509Certificate2 does not interpret the file as the proper input.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!