Mentalis.org Security Library documentation

CertificateStore.ToPfxFile Method 

Saves the CertificateStore as a PFX encoded file.

[Visual Basic]
Public Sub ToPfxFile( _
   ByVal filename As String, _
   ByVal password As String, _
   ByVal exportPrivateKeys As Boolean _
)
[C#]
public void ToPfxFile(
   string filename,
   string password,
   bool exportPrivateKeys
);

Parameters

filename
The filename of the new PFX file.
password
The password to use when encrypting the private keys.
exportPrivateKeys
true if the private keys should be exported [if possible], false otherwise.

Remarks

If the specified file already exists, the method will throw an exception.

Exceptions

Exception TypeCondition
ArgumentNullExceptionfilename or password is a null reference (Nothing in Visual Basic).
CertificateExceptionAn error occurs while exporting the certificate store.
IOExceptionAn error occurs while writing the data to the file.

See Also

CertificateStore Class | CertificateStore Members | Org.Mentalis.Security.Certificates Namespace