(Tcl) Workaround for the deprecated Crypt2.VerifyString method
Shows how to replace the deprecated VerifyString method. (Chilkat is moving away from the use of CkByteData.) Note: This example requires Chilkat v11.0.0 or greater.
load ./chilkat.dll
set crypt [new_CkCrypt2]
# Specifies how the original data bytes are converted to characters
CkCrypt2_put_Charset $crypt "utf-8"
set originalText "this is the string that was signed."
set sigPath "c:/someDir/example.p7s"
# ------------------------------------------------------------------------
# The OpaqueVerifyString method is deprecated:
set detachedSigBytes [new_CkByteData]
CkByteData_loadFile $detachedSigBytes $sigPath
set verified [CkCrypt2_VerifyString $crypt $originalText $detachedSigBytes]
# ------------------------------------------------------------------------
# Workaround.
# (Chilkat is moving away from using CkByteData)
set bdSig [new_CkBinData]
CkBinData_LoadFile $bdSig $sigPath
set encoding "base64"
CkCrypt2_put_EncodingMode $crypt $encoding
set verified [CkCrypt2_VerifyStringENC $crypt $originalText [CkBinData_getEncoded $bdSig $encoding]]
delete_CkCrypt2 $crypt
delete_CkByteData $detachedSigBytes
delete_CkBinData $bdSig
|