Rediger

Del via


X509CertificateLoader.LoadCertificateFromFile(String) Method

Definition

Loads a single X.509 certificate (in either the PEM or DER encoding) from the specified file.

public:
 static System::Security::Cryptography::X509Certificates::X509Certificate2 ^ LoadCertificateFromFile(System::String ^ path);
public static System.Security.Cryptography.X509Certificates.X509Certificate2 LoadCertificateFromFile (string path);
static member LoadCertificateFromFile : string -> System.Security.Cryptography.X509Certificates.X509Certificate2
Public Shared Function LoadCertificateFromFile (path As String) As X509Certificate2

Parameters

path
String

The path of the file to open.

Returns

The loaded certificate.

Exceptions

path is null.

The data did not load as a valid X.509 certificate.

An error occurred while loading the specified file.

Remarks

This method only loads plain certificates, which are identified as Cert by GetCertContentType(String)

Applies to

See also