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

Duplicate openssl dgst -sha256 -verify pubKey.pem -signature signature.sig in.dat

See more OpenSSL Examples

Demonstrates how to duplicate this OpenSSL command:
openssl dgst -sha256 -verify pubKey.pem -signature signature.sig in.dat
The in.dat file contains the original data that was signed, and can contain text or binary data of any type. The above OpenSSL command does the following:
  1. Creates a SHA256 digest of the contents of the input file.
  2. Verifies the SHA256 digest using the public key.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

;  This example requires the Chilkat API to have been previously unlocked.
;  See Global Unlock Sample for sample code.

$oPubKey = ObjCreate("Chilkat.PublicKey")

;  Load the public key from an PEM file:
$bSuccess = $oPubKey.LoadFromFile("pubKey.pem")
If ($bSuccess = False) Then
    ConsoleWrite($oPubKey.LastErrorText & @CRLF)
    Exit
EndIf

;  Load the data of the original file that was signed.
$oBdFileData = ObjCreate("Chilkat.BinData")
$bSuccess = $oBdFileData.LoadFile("in.dat")

;  Load the signature.
$oBdSig = ObjCreate("Chilkat.BinData")
$bSuccess = $oBdSig.LoadFile("signature.sig")

$oRsa = ObjCreate("Chilkat.Rsa")

;  Import the public key into the RSA component:
$bSuccess = $oRsa.UsePublicKey($oPubKey)
If ($bSuccess = False) Then
    ConsoleWrite($oRsa.LastErrorText & @CRLF)
    Exit
EndIf

;  OpenSSL uses big-endian.
$oRsa.LittleEndian = False

$bSuccess = $oRsa.VerifyBd($oBdFileData,"sha256",$oBdSig)
If ($bSuccess <> True) Then
    ConsoleWrite($oRsa.LastErrorText & @CRLF)
    ConsoleWrite("The signature was invalid." & @CRLF)
    Exit
EndIf

ConsoleWrite("The signature was verified." & @CRLF)