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

Transition from Email.GetSignedByCertChain to Email.LastSignerCert

Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$email = New-Object Chilkat.Email

#  ...
#  ...

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

$certChainObj = $email.GetSignedByCertChain()
if ($email.LastMethodSuccess -eq $false) {
    $($email.LastErrorText)
    exit
}

#  ...
#  ...

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

$signerCert = New-Object Chilkat.Cert
$success = $email.LastSignerCert(0,$signerCert)
if ($success -eq $false) {
    $($email.LastErrorText)
    exit
}

#  Get the certificate chain from the signer certificate.
$certChain = New-Object Chilkat.CertChain
$success = $signerCert.BuildCertChain($certChain)
if ($success -eq $false) {
    $($signerCert.LastErrorText)
    exit
}