Sample code for 30+ languages & platforms
Visual FoxPro

Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey

Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loCert
LOCAL loPrivatekeyObj
LOCAL loPrivatekeyOut

lnSuccess = 0

loCert = CreateObject('Chilkat.Cert')

* ------------------------------------------------------------------------
* The ExportPrivateKey method is deprecated:

loPrivatekeyObj = loCert.ExportPrivateKey()
IF (loCert.LastMethodSuccess = 0) THEN
    ? loCert.LastErrorText
    RELEASE loCert
    CANCEL
ENDIF

* ...
* ...

RELEASE loPrivatekeyObj

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

loPrivatekeyOut = CreateObject('Chilkat.PrivateKey')
lnSuccess = loCert.GetPrivateKey(loPrivatekeyOut)
IF (lnSuccess = 0) THEN
    ? loCert.LastErrorText
    RELEASE loCert
    RELEASE loPrivatekeyOut
    CANCEL
ENDIF

RELEASE loCert
RELEASE loPrivatekeyOut