public static StoreName?GetStoreName(this IClientCertArgsWithStoreData args) { if (Enum.TryParse(args.StoreName, ignoreCase: true, result: out StoreName value)) { return(value); } return(null); }
public static X509FindType?GetFindBy(this IClientCertArgsWithStoreData args) { if (Enum.TryParse("FindBy" + args.FindBy, ignoreCase: true, result: out X509FindType value)) { return(value); } return(null); }
public static bool IsStoreCertSettingsProvided(this IClientCertArgsWithStoreData args) { var isStoreLocationProvided = false; var isStoreNameProvided = false; var isFindTypeProvided = false; if (!string.IsNullOrWhiteSpace(args.StoreLocation)) { var storeLocation = args.GetStoreLocation(); if (storeLocation == null) { throw new CommandLineArgumentCombinationException(string.Format(CultureInfo.CurrentCulture, Strings.Error_UnknownClientCertificatesStoreLocation, args.StoreLocation)); } isStoreLocationProvided = true; } if (!string.IsNullOrWhiteSpace(args.StoreName)) { var storeName = args.GetStoreName(); if (storeName == null) { throw new CommandLineArgumentCombinationException(string.Format(CultureInfo.CurrentCulture, Strings.Error_UnknownClientCertificatesStoreName, args.StoreName)); } isStoreNameProvided = true; } if (!string.IsNullOrWhiteSpace(args.FindBy)) { var findBy = args.GetFindBy(); if (findBy == null) { throw new CommandLineArgumentCombinationException(string.Format(CultureInfo.CurrentCulture, Strings.Error_UnknownClientCertificatesFindBy, args.FindBy)); } isFindTypeProvided = true; } var isFindValueProvided = !string.IsNullOrEmpty(args.FindValue); return(isStoreLocationProvided || isStoreNameProvided || isFindTypeProvided || isFindValueProvided); }