由网友(舊顏如夢)分享简介:我怎样才能得到X509证书从证书存储区,然后生成.NET C#中的XML SignatureData?How can I get X509Certificate from certificate store and then generate XML SignatureData in .net C#?推荐答案AFA...
我怎样才能得到X509证书从证书存储区,然后生成.NET C#中的XML SignatureData?
How can I get X509Certificate from certificate store and then generate XML SignatureData in .net C#?
推荐答案
AFAIK,证书不会保存XML格式的,你应该自己结合起来。
AFAIK, certificates are not saved by XML Format , you should combine it by yourself.
这是你想要什么?
static void Main(string[] args)
{
X509Certificate2 cer = new X509Certificate2();
cer.Import(@"D:l.cer");
X509Store store = new X509Store(StoreLocation.CurrentUser);
store.Certificates.Add(cer);
X509Certificate2Collection cers = store.Certificates.Find(X509FindType.FindBySubjectName, "My Cert's Subject Name", false);
if (cers.Count>0)
{
cer = cers[0];
};
store.Close();
}
相关推荐
最新文章