X509Certificate Constructor Exception

后端 未结 9 1844
梦如初夏
梦如初夏 2020-11-27 15:38
//cert is an EF Entity and 
//    cert.CertificatePKCS12 is a byte[] with the certificate.

var certificate = new X509Certificate(cert.CertificatePKCS12, \"SomePassw         


        
9条回答
  •  攒了一身酷
    2020-11-27 16:12

    Use this code:

    certificate = new X509Certificate2(System.IO.File.ReadAllBytes(p12File)
                                       , p12FilePassword
                                       , X509KeyStorageFlags.MachineKeySet |
                                         X509KeyStorageFlags.PersistKeySet | 
                                         X509KeyStorageFlags.Exportable);
    

提交回复
热议问题