还有其他方法吗?
提前致谢!
答案 0 :(得分:0)
最近,我了解.p7b格式是什么。
static void ExportCert()
{
X509Certificate2 x509 = new X509Certificate2(@"E:\SimonSelf.pfx", "password", X509KeyStorageFlags.Exportable);
X509Certificate2Collection x509List = new X509Certificate2Collection(x509);
byte[] p7bBinary = x509List.Export(X509ContentType.Pkcs7);
using (FileStream fs = new FileStream(@"E:\SimonSelf.p7b", FileMode.Create))
{
fs.Write(p7bBinary, 0, p7bBinary.Length);
fs.Close();
}
}