Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey

Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oCert
LOCAL oPrivatekeyObj
LOCAL oPrivatekeyOut

nSuccess := 0

oCert := CreateObject("Chilkat.Cert")

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

oPrivatekeyObj := oCert:ExportPrivateKey()
IF (oCert:LastMethodSuccess == 0)
    ? oCert:LastErrorText
    oCert:destroy()
    RETURN
ENDIF

//  ...
//  ...

oPrivatekeyObj:destroy()

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

oPrivatekeyOut := CreateObject("Chilkat.PrivateKey")
nSuccess := oCert:GetPrivateKey(oPrivatekeyOut)
IF (nSuccess == 0)
    ? oCert:LastErrorText
    oCert:destroy()
    oPrivatekeyOut:destroy()
    RETURN
ENDIF

oCert:destroy()
oPrivatekeyOut:destroy()