Mentalis.org Security Library documentation

Certificate.ToPfxBuffer Method 

Saves the Certificate as a PFX encoded buffer.

[Visual Basic]
Public Function ToPfxBuffer( _
   ByVal password As String, _
   ByVal withPrivateKeys As Boolean, _
   ByVal withParents As Boolean _
) As Byte()
[C#]
public byte[] ToPfxBuffer(
   string password,
   bool withPrivateKeys,
   bool withParents
);

Parameters

password
The password to use when encrypting the private keys.
withPrivateKeys
true if the private keys should be exported [if possible], false otherwise.
withParents
true if the parent certificates should be exported too [if possible], false otherwise.

Return Value

An array of bytes that represents the PFX encoded certificate.

Exceptions

Exception TypeCondition
ArgumentNullExceptionpassword is a null reference (Nothing in Visual Basic).
CertificateExceptionAn error occurs while exporting the certificate store
-or-
an error occurs while building the certificate chain
-or-
an error occurs while creating the store
-or-
an error occurs while adding the certificate to the store.

See Also

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