我需要将证书客户端.pkcs12用于Windows Phone应用程序。 我不能使用X509Certificate类,因为不允许PKCS12。所以我下载了BouncyCastle类并制作了这个
try
{
FileStream Cert = new FileStream
("certificate.pkcs12",FileMode.Open,FileAccess.Read);
char[] password = new char[] { 'p','a','s','s','w','o','r','d' };
Pkcs12Store certificate = new Pkcs12Store(Cert,password);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
我获得了这个例外:
{System.TypeInitializationException:
The type initializer for 'Org.BouncyCastle.Asn1.Pkcs.PkcsObjectIdentifiers'
threw an exception. --->
System.IO.FileNotFoundException: Could not load file or assembly
答案 0 :(得分:0)
由于这是一个FileNotFoundException,我可能与BouncyCastle无关。您确定您的文件位于正确的位置并且使用了正确的文件名吗?