Mentalis.org Security Library documentation

Certificate.CreateFromPemFile Method (String)

Creates a new instance of the Certificate class by reading a certificate from a PEM encoded file.

[Visual Basic]
Overloads Public Shared Function CreateFromPemFile( _
   ByVal filename As String _
) As Certificate
[C#]
public static Certificate CreateFromPemFile(
   string filename
);

Parameters

filename
The path to the PEM file.

Return Value

A Certificate instance.

Remarks

This implementation only reads certificates from PEM files. It does not read the private key from the certificate file, if one is present.

Exceptions

Exception TypeCondition
ArgumentNullExceptionfilename if a null reference (Nothing in Visual Basic).
IOExceptionAn error occurs while reading from the file.
CertificateExceptionAn error occurs while reading the certificate from the PEM blob.

See Also

Certificate Class | Org.Mentalis.Security.Certificates Namespace | Certificate.CreateFromPemFile Overload List