abm*_*bmv 8 c# certificate keystore
如果PKI最终用户证书安装在用户windows密钥库(个人)中,有没有办法检查C#?(会有例外吗?)我会传递一些像Name这样的属性.
小智 9
您可以使用X509Store类在系统上搜索证书.下面的代码示例在当前用户的个人存储中按主题名称"XYZ"查找证书.
System.Security.Cryptography.X509Certificates.X509Store store = new System.Security.Cryptography.X509Certificates.X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly); // Dont forget. otherwise u will get an exception.
X509Certificate2Collection certs = store.Certificates.Find(X509FindType.FindBySubjectName,"XYZ",true);
if(certs.Count > 0)
{
// Certificate is found.
}
else
{
// No Certificate found by that subject name.
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4335 次 |
| 最近记录: |