Mentalis.org Security Library documentation

Certificate.AssociateWithPrivateKey Method (String, String, Boolean)

Associates the certificate with a private key from a PVK file.

[Visual Basic]
Overloads Public Sub AssociateWithPrivateKey( _
   ByVal pvkFile As String, _
   ByVal password As String, _
   ByVal exportable As Boolean _
)
[C#]
public void AssociateWithPrivateKey(
   string pvkFile,
   string password,
   bool exportable
);

Parameters

pvkFile
The path to the PVK file to open.
password
The password used to encrypt the private key.
exportable
true if the private key should be marked exportable, false otherwise.

Remarks

The password can be a null reference (Nothing in Visual Basic) if the private key is not encrypted.

Exceptions

Exception TypeCondition
ArgumentNullExceptionThe PVK file is encrypted and password is a null reference (Nothing in Visual Basic).
FileNotFoundExceptionThe specified file could not be found.
CertificateExceptionAn error occurs while importing the private key.

See Also

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