Sample code for 30+ languages & platforms
Perl

Transition from Email.GetSignedByCertChain to Email.LastSignerCert

Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.

Chilkat Perl Downloads

Perl
use chilkat();

$success = 0;

$email = chilkat::CkEmail->new();

# ...
# ...

# ------------------------------------------------------------------------
# The GetSignedByCertChain method is deprecated:

# certChainObj is a CertChain
$certChainObj = $email->GetSignedByCertChain();
if ($email->get_LastMethodSuccess() == 0) {
    print $email->lastErrorText() . "\r\n";
    exit;
}

# ...
# ...

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

$signerCert = chilkat::CkCert->new();
$success = $email->LastSignerCert(0,$signerCert);
if ($success == 0) {
    print $email->lastErrorText() . "\r\n";
    exit;
}

# Get the certificate chain from the signer certificate.
$certChain = chilkat::CkCertChain->new();
$success = $signerCert->BuildCertChain($certChain);
if ($success == 0) {
    print $signerCert->lastErrorText() . "\r\n";
    exit;
}