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

Transition from Cert.ExportPublicKey to Cert.GetPublicKey

Provides instructions for replacing deprecated ExportPublicKey method calls with GetPublicKey.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Cert
oleobject loo_PublickeyObj
oleobject loo_PublickeyOut

li_Success = 0

loo_Cert = create oleobject
li_rc = loo_Cert.ConnectToNewObject("Chilkat.Cert")
if li_rc < 0 then
    destroy loo_Cert
    MessageBox("Error","Connecting to COM object failed")
    return
end if

//  ------------------------------------------------------------------------
//  The ExportPublicKey method is deprecated:

loo_PublickeyObj = loo_Cert.ExportPublicKey()
if loo_Cert.LastMethodSuccess = 0 then
    Write-Debug loo_Cert.LastErrorText
    destroy loo_Cert
    return
end if

//  ...
//  ...

destroy loo_PublickeyObj

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

loo_PublickeyOut = create oleobject
li_rc = loo_PublickeyOut.ConnectToNewObject("Chilkat.PublicKey")

li_Success = loo_Cert.GetPublicKey(loo_PublickeyOut)
if li_Success = 0 then
    Write-Debug loo_Cert.LastErrorText
    destroy loo_Cert
    destroy loo_PublickeyOut
    return
end if



destroy loo_Cert
destroy loo_PublickeyOut