Sample code for 30+ languages & platforms
Tcl

Workaround for the deprecated Crypt2.OpaqueVerifyString method

Shows how to replace the deprecated OpaqueVerifyString method. (Chilkat is moving away from the use of CkByteData.)

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set crypt [new_CkCrypt2]

# Specifies how the original data bytes are converted to characters
CkCrypt2_put_Charset $crypt "utf-8"

set path "c:/someDir/example.dat"

# ------------------------------------------------------------------------
# The OpaqueVerifyString method is deprecated:

set inData [new_CkByteData]

CkByteData_loadFile $inData $path

set originalText [CkCrypt2_opaqueVerifyString $crypt $inData]

# ------------------------------------------------------------------------
# Workaround.
# (Chilkat is moving away from using CkByteData)

set bd [new_CkBinData]

CkBinData_LoadFile $bd $path

# If the opaque signature is validated, the contents of bd are replaced with the original data that was signed.
set success [CkCrypt2_OpaqueVerifyBd $crypt $bd]

# Indicate how the bytes are converted to chars by passing the charset.
set originalText [CkBinData_getString $bd "utf-8"]

delete_CkCrypt2 $crypt
delete_CkByteData $inData
delete_CkBinData $bd