如何在C#中导入PKCS#8 RSA私钥(由OpenSSL创建) [英] How to import PKCS#8 RSA privateKey (created by OpenSSL) in C#

查看:942
本文介绍了如何在C#中导入PKCS#8 RSA私钥(由OpenSSL创建)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试寻找一种方法,以在不使用外部库的情况下读取使用C#中的OpenSSL PKCS#8 RSA创建的私钥.

I'm trying to find a way to read a privateKey created using OpenSSL PKCS#8 RSA in C# without use external library.

有人知道我该怎么做吗?

Does Someone know how i can do this?

推荐答案

通过外部库使用 进行此操作的最简单方法是使用(免费)

The easiest way to do this with an external library, is using the (free) Chillkat Public / Private Key Component: using that, importing the key can be done using just a few lines of code and if you're willing to pay the $149 or so for the rest of the library, it will make dealing with general crypto concepts a lot easier as well.

与常规的Microsoft .NET Framework不同,Mono项目确实似乎具有完整的C#源代码可用.如果您绝对不能依赖外部库,这可能是一个起点,假设与Mono代码相关的(LGPL 2.0)许可证对您有效...

And unlike the regular Microsoft .NET Framework, the Mono project does seem to have a PKCS8 implementation for which the full C# source is available. This may be suitable as a starting point in case you absolutely cannot rely on external libraries, assuming the (LGPL 2.0) license associated with the Mono code works for you...

最后, PKCS#8格式不是太难解析了,RSA/DSA密钥对对象按照

Finally, the PKCS #8 format is not too difficult to parse, and the RSA/DSA key pair objects are as per PKCS #11 and relatively easy to convert to a .NET X509Certificate once you figure out where all the bits go -- I actually did this in VB.NET a while ago, but unfortunately am not able to share that code.

这篇关于如何在C#中导入PKCS#8 RSA私钥(由OpenSSL创建)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆