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

Transition from Email.GetSignedByCertChain to Email.LastSignerCert

Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oEmail
LOCAL oCertChainObj
LOCAL oSignerCert
LOCAL oCertChain

nSuccess := 0

oEmail := CreateObject("Chilkat.Email")

//  ...
//  ...

//  ------------------------------------------------------------------------
//  The GetSignedByCertChain method is deprecated:

oCertChainObj := oEmail:GetSignedByCertChain()
IF (oEmail:LastMethodSuccess == 0)
    ? oEmail:LastErrorText
    oEmail:destroy()
    RETURN
ENDIF

//  ...
//  ...

oCertChainObj:destroy()

//  ------------------------------------------------------------------------
//  Do the equivalent using LastSignerCert to get the signing certificate,
//  then build the cert chain from the signing certificate object.

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

//  Get the certificate chain from the signer certificate.
oCertChain := CreateObject("Chilkat.CertChain")
nSuccess := oSignerCert:BuildCertChain(oCertChain)
IF (nSuccess == 0)
    ? oSignerCert:LastErrorText
    oEmail:destroy()
    oSignerCert:destroy()
    oCertChain:destroy()
    RETURN
ENDIF

oEmail:destroy()
oSignerCert:destroy()
oCertChain:destroy()