private X509Certificate2 GetCertificateByHash(byte[] certHash) { X509Certificate2 result = null; using (var certStore = new X509Store(StoreLocation.LocalMachine)) { certStore.Open(OpenFlags.ReadOnly); var thumbprint = string.Join("", certHash.Select(a => string.Format("{0:X}", a).PadLeft(2, '0'))); var certs = certStore.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false); if (certs.Count > 0) { result = certs[0]; } certStore.Close(); } return result; }
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.