Sample code for 30+ languages & platforms
C#

Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey

Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey.

Chilkat C# Downloads

C#
bool success = false;

Chilkat.Cert cert = new Chilkat.Cert();

//  ------------------------------------------------------------------------
//  The ExportPrivateKey method is deprecated:

Chilkat.PrivateKey privatekeyObj = cert.ExportPrivateKey();
if (cert.LastMethodSuccess == false) {
    Debug.WriteLine(cert.LastErrorText);
    return;
}

//  ...
//  ...

//  ------------------------------------------------------------------------
//  Do the equivalent using GetPrivateKey.
//  Your application creates a new, empty PrivateKey object which is passed 
//  in the last argument and filled upon success.

Chilkat.PrivateKey privatekeyOut = new Chilkat.PrivateKey();
success = cert.GetPrivateKey(privatekeyOut);
if (success == false) {
    Debug.WriteLine(cert.LastErrorText);
    return;
}