GetCertificateFromPassedStore() public static method

Helper method: Search passed store for certificate with passed public key hash.
public static GetCertificateFromPassedStore ( byte publicKeyHash, X509Store store ) : X509Certificate2
publicKeyHash byte
store System.Security.Cryptography.X509Certificates.X509Store
return System.Security.Cryptography.X509Certificates.X509Certificate2
Beispiel #1
0
        public static X509Certificate2 GetCertificateFromStore(byte[] publicKeyHash)
        {
            X509Store        store1 = new X509Store(StoreLocation.CurrentUser);
            X509Certificate2 certificateFromPassedStore = SEBProtectionController.GetCertificateFromPassedStore(publicKeyHash, store1);

            if (certificateFromPassedStore == null)
            {
                X509Store store2 = new X509Store(StoreLocation.LocalMachine);
                certificateFromPassedStore = SEBProtectionController.GetCertificateFromPassedStore(publicKeyHash, store2);
            }
            return(certificateFromPassedStore);
        }