Sample code for 30+ languages & platforms
Unicode C

Example: Crypt2.SetEncodedIV method

Demonstrates how to call the SetEncodedIV method.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkCrypt2W.h>

void ChilkatSample(void)
    {
    HCkCrypt2W crypt;

    crypt = CkCrypt2W_Create();

    CkCrypt2W_putCryptAlgorithm(crypt,L"aes");
    CkCrypt2W_putCipherMode(crypt,L"cbc");
    CkCrypt2W_putKeyLength(crypt,256);

    //  Note: The lenght of the IV is equal to the block size of the symmetric encryption algorithm.
    //  The block size for AES is 16 bytes.  Therefore, the IV is 16 bytes regardless of the encryption strenght (128-bit, 256-bit, etc.)
    CkCrypt2W_SetEncodedIV(crypt,L"000102030405060708090A0B0C0D0E0F",L"hex");

    //  ...
    //  ...


    CkCrypt2W_Dispose(crypt);

    }