我使用 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/