Sample code for 30+ languages & platforms
Lianja

Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey

Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loCert = createobject("CkCert")

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

loPrivatekeyObj = loCert.ExportPrivateKey()
if (loCert.LastMethodSuccess = .F.) then
    ? loCert.LastErrorText
    release loCert
    return
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("CkPrivateKey")
llSuccess = loCert.GetPrivateKey(loPrivatekeyOut)
if (llSuccess = .F.) then
    ? loCert.LastErrorText
    release loCert
    release loPrivatekeyOut
    return
endif



release loCert
release loPrivatekeyOut