I have a problem when I use the X509Store.Certificates.Find method
public static X509Certificate2 FromStore(StoreName storeName, StoreLocation storeLocation, X509FindType findType, string findValue) { X509Store store = new X509Store(storeName, storeLocation); store.Open(OpenFlags.ReadOnly); try {
In this case, the Find method returns 0 results ( results.Count == 0 ), but if I put findValue as a constant, the method will find the certificate.
public static X509Certificate2 FromStore(StoreName storeName, StoreLocation storeLocation, X509FindType findType, string findValue) { X509Store store = new X509Store(storeName, storeLocation); store.Open(OpenFlags.ReadOnly); try { //findValue= "7a6fa503ab57b81d6318a51ca265e739a51ce660" var results = store.Certificates.Find(findType, "7a6fa503ab57b81d6318a51ca265e739a51ce660", true); return results[0]; } finally { store.Close(); } }
c # certificate ssl-certificate wcf x509certificate
nunofamel Dec 09 '11 at 15:58 2011-12-09 15:58
source share