Unicode C++
Unicode C++
Example: Crypt2.EncryptSb method
Demonstrates how to call the EncryptSb method.Chilkat Unicode C++ Downloads
#include <CkCrypt2W.h>
#include <CkBinDataW.h>
#include <CkStringBuilderW.h>
void ChilkatSample(void)
{
bool success = false;
CkCrypt2W crypt;
CkBinDataW bdEncrypted;
CkStringBuilderW sbPlainText;
sbPlainText.Append(L"Text to be encrypted");
// ...
// Set the secret key ...
// Set properties such as CryptAlgorithm, CipherMode, PaddingScheme, KeyLength
// Set the IV if needed ...
// ...
crypt.put_Charset(L"utf-8");
success = crypt.EncryptSb(sbPlainText,bdEncrypted);
if (success == false) {
wprintf(L"%s\n",crypt.lastErrorText());
return;
}
}