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

Sign an EML using RSA-PSS and SHA-256

See more Email Object Examples

Load the intended signing certificate and its RSA private key from a PFX. Set the signature options on Email and render the final S/MIME message through MailMan. The resulting multipart/signed file can be verified independently. Supply the PFX password through your application’s credential store.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

;  Assumes Chilkat is unlocked. See Global Unlock Sample.

$oEmail = ObjCreate("Chilkat.Email")
$bSuccess = $oEmail.LoadEml("message.eml")
If ($bSuccess <> True) Then
    ConsoleWrite($oEmail.LastErrorText & @CRLF)
    Exit
EndIf

$oCert = ObjCreate("Chilkat.Cert")
$bSuccess = $oCert.LoadPfxFile("signer.pfx","PFX_PASSWORD")
If ($bSuccess <> True) Then
    ConsoleWrite($oCert.LastErrorText & @CRLF)
    Exit
EndIf

$bSuccess = $oEmail.SetSigningCert($oCert)
If ($bSuccess <> True) Then
    ConsoleWrite($oEmail.LastErrorText & @CRLF)
    Exit
EndIf

$oEmail.SigningAlg = "pss"
$oEmail.SigningHashAlg = "sha256"
$oEmail.SendSigned = True
$oMail = ObjCreate("Chilkat.MailMan")
$oMail.OpaqueSigning = False
$oRendered = ObjCreate("Chilkat.BinData")
$bSuccess = $oMail.RenderToMimeBd($oEmail,$oRendered)
If ($bSuccess <> True) Then
    ConsoleWrite($oMail.LastErrorText & @CRLF)
    Exit
EndIf

$bSuccess = $oRendered.WriteFile("signed.eml")
If ($bSuccess <> True) Then
    ConsoleWrite("Failed: rendered.WriteFile." & @CRLF)
    Exit
EndIf

ConsoleWrite("Saved signed.eml." & @CRLF)