gpt4 book ai didi

c# - 从磁盘 .Net Core 加载 X509 证书

转载 作者:可可西里 更新时间:2023-11-01 09:01:46 25 4
gpt4 key购买 nike

我使用 OpenSSL 创建了一个 X509 证书。我正在尝试使用 .NET Core 2.0 中 X509Certificate2 类的 Import 方法加载它。

var cert = new X509Certificate2();
cert.Import(_path);

但是抛出如下异常:

System.PlatformNotSupportedException : X509Certificate is immutable on this 
platform. Use the equivalent constructor instead.

我应该使用哪个构造函数/从磁盘加载此证书的正确方法是什么?

最佳答案

你可以使用

var x509 = new X509Certificate2(File.ReadAllBytes(_path));

关于c# - 从磁盘 .Net Core 加载 X509 证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47756451/

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