Sample code for 30+ languages & platforms
PHP ActiveX

Transition from Email.GetSignedByCertChain to Email.LastSignerCert

Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

$email = new COM("Chilkat.Email");

// ...
// ...

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

// certChainObj is a Chilkat.CertChain
$certChainObj = $email->GetSignedByCertChain();
if ($email->LastMethodSuccess == 0) {
    print $email->LastErrorText . "\n";
    exit;
}

// ...
// ...

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

$signerCert = new COM("Chilkat.Cert");
$success = $email->LastSignerCert(0,$signerCert);
if ($success == 0) {
    print $email->LastErrorText . "\n";
    exit;
}

// Get the certificate chain from the signer certificate.
$certChain = new COM("Chilkat.CertChain");
$success = $signerCert->BuildCertChain($certChain);
if ($success == 0) {
    print $signerCert->LastErrorText . "\n";
    exit;
}


?>