PHP Extension
PHP Extension
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 PHP Extension Downloads
<?php
include("chilkat.php");
$crypt = new 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 = new CkByteData();
$detachedSigBytes->loadFile($sigPath);
$verified = $crypt->VerifyString($originalText,$detachedSigBytes);
// ------------------------------------------------------------------------
// Workaround.
// (Chilkat is moving away from using CkByteData)
$bdSig = new CkBinData();
$bdSig->LoadFile($sigPath);
$encoding = 'base64';
$crypt->put_EncodingMode($encoding);
$verified = $crypt->VerifyStringENC($originalText,$bdSig->getEncoded($encoding));
?>