相关疑难解决方法(0)

X509Certificate构造函数异常

//cert is an EF Entity and 
//    cert.CertificatePKCS12 is a byte[] with the certificate.

var certificate = new X509Certificate(cert.CertificatePKCS12, "SomePassword");
Run Code Online (Sandbox Code Playgroud)

从我们的数据库加载证书时,在我们的登台服务器(Windows 2008 R2/IIS7.5)上,我们遇到以下异常:

System.Security.Cryptography.CryptographicException: An internal error occurred.

   at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
   at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromBlob(Byte[] rawData, IntPtr password, UInt32 dwFlags, Boolean persistKeySet, SafeCertContextHandle& pCertCtx)
   at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[] rawData, Object password, X509KeyStorageFlags keyStorageFlags)
Run Code Online (Sandbox Code Playgroud)

注意:此问题不会在本地发生(Windows 7/Casini).

非常感谢任何见解.

.net c# x509certificate

68
推荐指数
4
解决办法
4万
查看次数

标签 统计

.net ×1

c# ×1

x509certificate ×1