Mentalis.org Security Library documentation

Certificate.CreateFromPfxFile Method (String, String, Boolean)

Creates a new instance of the Certificate class by opening a PFX file and retrieving the first certificate from it.

[Visual Basic]
Overloads Public Shared Function CreateFromPfxFile( _
   ByVal file As String, _
   ByVal password As String, _
   ByVal exportable As Boolean _
) As Certificate
[C#]
public static Certificate CreateFromPfxFile(
   string file,
   string password,
   bool exportable
);

Parameters

file
The full path to the PFX file.
password
The password used to encrypt the private key.
exportable
true if the private keys associated with the certificates should be marked as exportable, false otherwise.

Return Value

One of the certificates in the PFX file.

Exceptions

Exception TypeCondition
ArgumentNullExceptionfile or password is a null reference (Nothing in Visual Basic).
CertificateExceptionAn error occurs while loading certificates from the specified file.

See Also

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