在Compact Framework 3.5中加载PFX [英] Load PFX in Compact Framework 3.5

查看:69
本文介绍了在Compact Framework 3.5中加载PFX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好


我需要创建一个带字节数组的X509Certificate2。


字节数组来自PFX证书,即无密码。


 


            FileStream fs = File.Open(" mycert2.pfx",FileMode.Open,FileAccess.Read);
$


       ;      byte [] buffer = new byte [fs.Length];



            ; int count = fs.Read(buffer,0,buffer.Length);
$


             fs.Close();
$


            X509Certificate2 cert = new X509Certificate2(缓冲区);


 


但是当我尝试创建对象时,收到消息:


创建证书对象失败。传入的数据不正确或.NET Compact Framework不支持。 .NET Compact Framework不支持从pfx文件读取。

StackTrace

  在System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte [] rawData)

  在System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte []数据)

  在System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte [] rawData)


 


是否可以在Compact Framework 3.5?

解决方案

你好,


我遇到同样的问题你找到了吗溶液??????


Hi

I need to create a X509Certificate2 with a byte array.

The byte array is from a PFX certificate which is passwordless.

 

            FileStream fs = File.Open("mycert2.pfx", FileMode.Open, FileAccess.Read);

            byte[] buffer = new byte[fs.Length];

            int count = fs.Read(buffer, 0, buffer.Length);

            fs.Close();

            X509Certificate2 cert = new X509Certificate2(buffer);

 

but when i try to create the object a receive the message:

Creating certificate object failed. The data passed in is either incorrect or is not supported by .NET Compact Framework. .NET Compact Framework does not support reading from pfx files.
StackTrace
   at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[] rawData)
   at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[] data)
   at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData)

 

is it possible to do this in Compact Framework 3.5?

解决方案

Hello,

I have a same problem did you find any solution??????


这篇关于在Compact Framework 3.5中加载PFX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆