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

Transition from Crypt2.GetSignerCertChain to Crypt2.LastSignerCert

Provides instructions for replacing deprecated GetSignerCertChain method calls with LastSignerCert.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oCrypt2
LOCAL nIndex
LOCAL oCertchainObj
LOCAL oSignerCert
LOCAL oCertChain

nSuccess := 0

oCrypt2 := CreateObject("Chilkat.Crypt2")

//  ...
//  ...
nIndex := 0

//  ------------------------------------------------------------------------
//  The GetSignerCertChain method is deprecated:

oCertchainObj := oCrypt2:GetSignerCertChain(nIndex)
IF (oCrypt2:LastMethodSuccess == 0)
    ? oCrypt2:LastErrorText
    oCrypt2:destroy()
    RETURN
ENDIF

//  ...
//  ...

oCertchainObj:destroy()

//  ------------------------------------------------------------------------
//  Do the equivalent using LastSignerCert, and then get the certificate chain from the cert.
//  Your application creates a new, empty Cert object which is passed 
//  in the last argument and filled upon success.

oSignerCert := CreateObject("Chilkat.Cert")
nSuccess := oCrypt2:LastSignerCert(nIndex, oSignerCert)
IF (nSuccess == 0)
    ? oCrypt2:LastErrorText
    oCrypt2:destroy()
    oSignerCert:destroy()
    RETURN
ENDIF

oCertChain := CreateObject("Chilkat.CertChain")
nSuccess := oSignerCert:BuildCertChain(oCertChain)
IF (nSuccess == 0)
    ? oSignerCert:LastErrorText
    oCrypt2:destroy()
    oSignerCert:destroy()
    oCertChain:destroy()
    RETURN
ENDIF

oCrypt2:destroy()
oSignerCert:destroy()
oCertChain:destroy()