Exemple #1
0
 public static X509Certificate2 FindCertificateByThumbprint(string thumbprint, bool validOnly = true, bool throwIfMultipleOrNoMatch = false)
 {
     if (string.IsNullOrEmpty(thumbprint))
     {
         throw new ArgumentException("Serial number cannot be null or empty");
     }
     return(CertificateFinder.Find <string>(thumbprint, validOnly, new Func <StoreName, StoreLocation, bool, string, bool, X509Certificate2>(CertificateFinder.FindCertificateByThumbprint), throwIfMultipleOrNoMatch));
 }
Exemple #2
0
 public static X509Certificate2 FindCertificateBySerialNumber(StoreName storeName, StoreLocation storeLocation, bool validOnly, string serialNumber, bool throwIfMultipleOrNoMatch = false)
 {
     if (string.IsNullOrEmpty(serialNumber))
     {
         throw new ArgumentException("Serial number cannot be null or empty");
     }
     return(CertificateFinder.Find(storeName, storeLocation, X509FindType.FindBySerialNumber, validOnly, serialNumber, throwIfMultipleOrNoMatch));
 }
Exemple #3
0
 public static X509Certificate2 FindCertificateByName(StoreName storeName, StoreLocation storeLocation, bool validOnly, string name, bool throwIfMultipleOrNoMatch = false)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentException("Name cannot be null or empty");
     }
     return(CertificateFinder.Find(storeName, storeLocation, X509FindType.FindBySubjectName, validOnly, name, throwIfMultipleOrNoMatch));
 }
Exemple #4
0
 public static X509Certificate2 FindCertificateByName(string name, bool validOnly = true, bool throwIfMultipleOrNoMatch = false)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw new ArgumentException("name cannot be null or empty");
     }
     return(CertificateFinder.Find <string>(name, validOnly, new Func <StoreName, StoreLocation, bool, string, bool, X509Certificate2>(CertificateFinder.FindCertificateByName), throwIfMultipleOrNoMatch));
 }