Sample code for 30+ languages & platforms
C++

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 C++ Downloads

C++
#include <CkCrypt2.h>
#include <CkByteData.h>
#include <CkBinData.h>

void ChilkatSample(void)
    {
    CkCrypt2 crypt;

    //  Specifies how the original data bytes are converted to characters
    crypt.put_Charset("utf-8");

    const char *originalText = "this is the string that was signed.";
    const char *sigPath = "c:/someDir/example.p7s";

    //  ------------------------------------------------------------------------
    //  The OpaqueVerifyString method is deprecated:

    CkByteData detachedSigBytes;
    detachedSigBytes.loadFile(sigPath);

    bool verified = crypt.VerifyString(originalText,detachedSigBytes);

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

    CkBinData bdSig;
    bdSig.LoadFile(sigPath);

    const char *encoding = "base64";
    crypt.put_EncodingMode(encoding);
    verified = crypt.VerifyStringENC(originalText,bdSig.getEncoded(encoding));
    }