CkPython
CkPython
Workaround for the deprecated Crypt2.VerifyString method
Shows how to replace the deprecated VerifyString method. (Chilkat is moving away from the use of CkByteData.)Chilkat CkPython Downloads
import chilkat
crypt = chilkat.CkCrypt2()
# Specifies how the original data bytes are converted to characters
crypt.put_Charset("utf-8")
originalText = "this is the string that was signed."
sigPath = "c:/someDir/example.p7s"
# ------------------------------------------------------------------------
# The OpaqueVerifyString method is deprecated:
detachedSigBytes = chilkat.CkByteData()
detachedSigBytes.loadFile(sigPath)
verified = crypt.VerifyString(originalText,detachedSigBytes)
# ------------------------------------------------------------------------
# Workaround.
# (Chilkat is moving away from using CkByteData)
bdSig = chilkat.CkBinData()
bdSig.LoadFile(sigPath)
encoding = "base64"
crypt.put_EncodingMode(encoding)
verified = crypt.VerifyStringENC(originalText,bdSig.getEncoded(encoding))