Sample code for 30+ languages & platforms
Go

Transition from Email.GetSignedByCertChain to Email.LastSignerCert

Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.

Chilkat Go Downloads

Go
    success := false

    email := chilkat.NewEmail()

    // ...
    // ...

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

    certChainObj := email.GetSignedByCertChain()
    if email.LastMethodSuccess() == false {
        fmt.Println(email.LastErrorText())
        email.DisposeEmail()
        return
    }

    // ...
    // ...

    certChainObj.DisposeCertChain()

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

    signerCert := chilkat.NewCert()
    success = email.LastSignerCert(0,signerCert)
    if success == false {
        fmt.Println(email.LastErrorText())
        email.DisposeEmail()
        signerCert.DisposeCert()
        return
    }

    // Get the certificate chain from the signer certificate.
    certChain := chilkat.NewCertChain()
    success = signerCert.BuildCertChain(certChain)
    if success == false {
        fmt.Println(signerCert.LastErrorText())
        email.DisposeEmail()
        signerCert.DisposeCert()
        certChain.DisposeCertChain()
        return
    }


    email.DisposeEmail()
    signerCert.DisposeCert()
    certChain.DisposeCertChain()