Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在存储C中通过哈希查找证书#_C#_.net_Store_X509certificate - Fatal编程技术网

C# 在存储C中通过哈希查找证书#

C# 在存储C中通过哈希查找证书#,c#,.net,store,x509certificate,C#,.net,Store,X509certificate,如何使用C#在Windows应用商店中通过哈希获取证书 sha1示例:7a0b021806bffdb826205dac094030f8045d4daa 此循环有效,但: X509Store store = new X509Store(StoreName.My); store.Open(OpenFlags.ReadOnly); foreach (X509Certificate2 mCert in store.Certificates) { Console.WriteLine( mCer

如何使用C#在Windows应用商店中通过哈希获取证书

sha1示例:7a0b021806bffdb826205dac094030f8045d4daa

此循环有效,但:

X509Store store = new X509Store(StoreName.My);

store.Open(OpenFlags.ReadOnly);

foreach (X509Certificate2 mCert in store.Certificates)
{
    Console.WriteLine( mCert.Thumbprint);
}

store.Close();
有直接的方法吗?

var cert=store.Certificates.Find(
var cert = store.Certificates.Find(
                                    X509FindType.FindByThumbprint,
                                    thumbprint,
                                    true
                                  ).OfType<X509Certificate>().FirstOrDefault();
X509FindType.FindByThumbprint, 指纹, 真的 ).OfType().FirstOrDefault();
使用

store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, true)