Delphi DLL Requires Chilkat v11.0.0+
Delphi DLL
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 Delphi DLL Downloads
var
success: Boolean;
crypt: HCkCrypt2;
keyBytes: HCkByteData;
bdKey: HCkBinData;
encoding: PWideChar;
base64_mackey: PWideChar;
begin
success := False;
crypt := CkCrypt2_Create();
// ------------------------------------------------------------------------
// The SetMacKeyBytes method is deprecated:
keyBytes := CkByteData_Create();
// ...
// ...
success := CkCrypt2_SetMacKeyBytes(crypt,keyBytes);
// ------------------------------------------------------------------------
// Workaround.
// (Chilkat is moving away from using CkByteData)
bdKey := CkBinData_Create();
// ...
// ...
encoding := 'base64';
base64_mackey := CkBinData__getEncoded(bdKey,encoding);
success := CkCrypt2_SetMacKeyEncoded(crypt,base64_mackey,encoding);
CkCrypt2_Dispose(crypt);
CkByteData_Dispose(keyBytes);
CkBinData_Dispose(bdKey);