Sample code for 30+ languages & platforms
C++

Workaround for the deprecated Crypt2.SetMacKeyBytes method

Shows how to replace the deprecated SetMacKeyBytes 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)
    {
    bool success = false;

    CkCrypt2 crypt;

    //  ------------------------------------------------------------------------
    //  The SetMacKeyBytes method is deprecated:

    CkByteData keyBytes;
    //  ...
    //  ...

    success = crypt.SetMacKeyBytes(keyBytes);

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

    CkBinData bdKey;
    //  ...
    //  ...

    const char *encoding = "base64";
    const char *base64_mackey = bdKey.getEncoded(encoding);

    success = crypt.SetMacKeyEncoded(base64_mackey,encoding);
    }