Share via


CertificateLoader.LoadFromStoreCert Method

Definition

Loads a certificate from the certificate store.

public:
 static System::Security::Cryptography::X509Certificates::X509Certificate2 ^ LoadFromStoreCert(System::String ^ subject, System::String ^ storeName, System::Security::Cryptography::X509Certificates::StoreLocation storeLocation, bool allowInvalid);
public static System.Security.Cryptography.X509Certificates.X509Certificate2 LoadFromStoreCert (string subject, string storeName, System.Security.Cryptography.X509Certificates.StoreLocation storeLocation, bool allowInvalid);
static member LoadFromStoreCert : string * string * System.Security.Cryptography.X509Certificates.StoreLocation * bool -> System.Security.Cryptography.X509Certificates.X509Certificate2
Public Shared Function LoadFromStoreCert (subject As String, storeName As String, storeLocation As StoreLocation, allowInvalid As Boolean) As X509Certificate2

Parameters

subject
String

The certificate subject.

storeName
String

The certificate store name.

storeLocation
StoreLocation

The certificate store location.

allowInvalid
Boolean

Whether or not to load certificates that are considered invalid.

Returns

The loaded certificate.

Remarks

Exact subject match is loaded if present, otherwise best matching certificate with the subject name that contains supplied subject. Subject comparison is case-insensitive.

Applies to