gpt4 book ai didi

C# x509 证书解码器

转载 作者:行者123 更新时间:2023-12-02 11:01:52 25 4
gpt4 key购买 nike

我正在寻找 C# 代码,如何从字符串中解码 x509 证书,如本页所示:https://www.sslshopper.com/certificate-decoder.html

我有一个证书字符串,以 MII... 开头,以 == 结尾。

当我在 https://www.sslshopper.com/certificate-decoder.html 中传递它时它有效,但我想拥有自己的工具,例如这个网站。

有什么帮助吗?

最佳答案

I have a certificate string, that starts with MII... and ends with ==

它是 ASN.1 DER 编码证书的 Base64 格式。您可以将此字符串转换为字节数组,然后构造 X509Certificate2 类的实例:

byte[] bytes = Convert.FromBase64String("MII<...>==");
var cert = new X509Certificate2(bytes);

进一步阅读:

Convert.FromBase64String Method (String)

X509Certificate2 Class

关于C# x509 证书解码器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39954624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com