Perl
Perl
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 Perl Downloads
use chilkat();
$crypt = chilkat::CkCrypt2->new();
# 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->new();
$detachedSigBytes->loadFile($sigPath);
$verified = $crypt->VerifyString($originalText,$detachedSigBytes);
# ------------------------------------------------------------------------
# Workaround.
# (Chilkat is moving away from using CkByteData)
$bdSig = chilkat::CkBinData->new();
$bdSig->LoadFile($sigPath);
$encoding = "base64";
$crypt->put_EncodingMode($encoding);
$verified = $crypt->VerifyStringENC($originalText,$bdSig->getEncoded($encoding));