使用OpenSSL-Net将.der转换为.pem [英] Convert .der to .pem using OpenSSL-Net

查看:457
本文介绍了使用OpenSSL-Net将.der转换为.pem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.der证书,该证书是二进制编码的,需要以编程方式在.net中转换为.pem文件

I have a .der certificate that is binary encoded which needs to be converted to a .pem file programatically in .net

此行在OSX上使用OpenSSL给出正确的输出:

This line gives the correct output using OpenSSL on OSX:

openssl x509 -inform der -in cert.crt -out cert.pem

但是我们需要在.net中做同样的事情

But we need to do the same in .net

我们尝试了许多解决方案,但完全陷入困境.

We have tried many solutions but are completely stuck.

会进行以下工作吗?

var oc = OpenSSL.X509.X509Certificate.FromDER(bio); 

任何建议都非常欢迎:)

Any advice very welcome :)

推荐答案

最后,我们能够使用它将DER导入到字符串中,然后可以将其导出到PEM:

In the end we were able to use this to import the DER into a string which we could then export to a PEM:

var oc = OpenSSL.X509.X509Certificate.FromDER(bio);

这些页面很有用:

https://github.com/openssl-net/openssl-net/blob/master/ManagedOpenSsl/X509/X509Certificate.cs

https://msdn.microsoft. com/en-us/library/system.security.cryptography.x509certificates.x509certificate2.rawdata

非常感谢您的帮助:)

这篇关于使用OpenSSL-Net将.der转换为.pem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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