通过指纹查找证书

时间:2014-05-15 07:33:55

标签: c# .net x509certificate

系统无法通过字符串指纹找到证书

       var thumbprint = "‎2E7F6E8A0124E6745C3999EE15770C0A4931F342";
        X509Certificate2 certificate = new X509Certificate2();
        X509Store store = new X509Store(StoreName.TrustedPeople, StoreLocation.CurrentUser);
        store.Open(OpenFlags.OpenExistingOnly);
        var c = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false).OfType<X509Certificate>().FirstOrDefault();

此核心返回null。但我也试过这个

foreach (X509Certificate2 mCert in store.Certificates)
        {

           var c= store.Certificates.Find(X509FindType.FindByThumbprint, mCert.Thumbprint, false).Count;
        }

c总是1,所以有些问题出现在字符中。我复制了这个指纹值。

1 个答案:

答案 0 :(得分:8)

以下适用于我:

std::set<MyPoint2D>