从X509Certificate2在ASN.1符号导出证书

编程入门 行业动态 更新时间:2024-10-18 22:27:03
本文介绍了从X509Certificate2在ASN.1符号导出证书的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

目前,我正在学习使用证书的,现在我很好奇,如果有可能从一个 X509Certificate2一个加载证书的ASN.1表示 - 实例。

I'm currently learning working with certificates and now I'm curious, if it is possible to get the ASN.1 notation of a loaded certificate from a X509Certificate2-instance.

我已经找到了导出 - 方法,它工作正常,但我还没有看到一个possibilty改变输出格式的编码 - 这是只有在DER-格式。

I have found the Export-Method and it works fine, however I have not seen a possibilty to change the encoding of the output format - it's only in the DER-format.

是否有可能出口/转换加载的证书作为ASCII ASN.1的证书,像下面的例子:

Is there a possibility to export/convert a loaded certificate as an ASCII ASN.1 certificate, something like in the example below:

Certificate: Data: Version: 3 (0x2) Serial Number: 1 (0x1) Signature Algorithm: md5WithRSAEncryption Issuer: C=XY.... ...

或者是有一个转换器,DER转换为纯文本?

Or is there a converter to convert DER to plain text?

推荐答案

我写了一个GTK#工具(在C#),以在几年前这样做。完整的源$ C ​​$ C可从 github/mono /单工具/树/主/ asn1view

I wrote a Gtk# tool (in C#) to do this a few years ago. The full source code is available from github/mono/mono-tools/tree/master/asn1view

您可能只需要通用/ prettyPrinter.cs 和的普通/ ASN1De coder.cs ,除非你想为OID的pretty的名字。

You likely need only common/PrettyPrinter.cs and common/ASN1Decoder.cs unless you want pretty names for OIDs.

修改:以上是有点低级别比X.509证书 - 但它会为X.509 CRL,你知道(或没有),可以被嵌入到其他结构证书/ CRL。

EDIT: The above is a bit lower-level than X.509 certificates - but it will work for X.509 CRL and other structures you know (or not) that can be embedded into the certificates/crl.

更多推荐

从X509Certificate2在ASN.1符号导出证书

本文发布于:2023-11-13 02:09:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583126.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:符号   证书   ASN

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!