public static X509Certificate2 GetCertificateFromStore(string certName) { X509Store store = new X509Store(StoreLocation.CurrentUser); try { store.Open(OpenFlags.ReadOnly); X509Certificate2Collection certCollection = store.Certificates; X509Certificate2Collection currentCerts = certCollection.Find(X509FindType.FindByTimeValid, DateTime.Now, false); X509Certificate2 o = currentCerts[0]; X509Certificate2Collection signingCert = currentCerts.Find(X509FindType.FindBySubjectName, certName, false); if (signingCert.Count == 0) return null; return signingCert[0]; } finally { store.Close(); } }
c# Возвращаем сертификат из хранилища Windows сертификатов / c# get certificate from windows store
Subscribe to:
Post Comments (Atom)
Спасибо! Все прекрасно, понятно
ReplyDeleteзабирайте на здоровье :)
Delete