The class AESFile provides means to create and work with AES encrypted files. Derived from BaseFile working with AES files works exactly the same as with other files, with the only exception of opening the file. So it is recommended to read BaseFile Manual first.
Filename fnInput;
AutoAlloc<BaseFile> fileInput;
AutoAlloc<AESFile> fileAes;
if (!fileInput || !fileAes)
{
}
Filename fnAes = fnInput;
fnAes.SetSuffix("aes"_s);
const char pw[] = { 's', 'p', 'e', 'a', 'k', ',', ' ', 'f', 'r', 'i', 'e', 'n', 'd', ',', ' ', 'a', 'n', 'd', ' ', 'e', 'n', 't', 'e', 'r' };
const Int32 keylen =
sizeof(pw) * 8;
DebugAssert((keylen == 128) || (keylen == 192) || (keylen == 256));
const Int32 blocksize = 256;
{
}
const Int fileSize = fileInput->GetLength();
const Int readBytes = fileInput->TryReadBytes(
buffer, fileSize);
if (readBytes != fileSize)
{
}
if (!fileAes->WriteBytes(
buffer, fileSize))
{
}
fileAes->Close();
fileInput->Close();
if (AESFile::CheckEncryption(fnAes, fnInput, pw, keylen, blocksize))
{
}
else
{
return maxon::UnexpectedError(
MAXON_SOURCE_LOCATION,
"Error: The encrypted file does not match the encrypted version."_s);
}
const char ** buffer
Definition: abstract.h:327
NONE
Definition: asset_browser.h:1
LOAD
Load.
Definition: c4d_filterdata.h:1
#define NewMemClear(T, cnt)
Definition: defaultallocator.h:216
READ
Problems reading the file.
Definition: ge_prepass.h:3
WRITE
Problems writing the file.
Definition: ge_prepass.h:4
V_INTEL
Intel, little endian.
Definition: ge_prepass.h:2
ANYTHING
Any file.
Definition: ge_prepass.h:0
return OK
Definition: apibase.h:2740
#define MACCREATOR_CINEMA
Standard Mac creator code for Cinema 4D.
Definition: ge_prepass.h:30
#define MACTYPE_CINEMA
Standard Mac type code for Cinema 4D.
Definition: ge_prepass.h:29
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
#define DebugAssert(condition,...)
Definition: debugdiagnostics.h:242
ANY
Definition: lib_substance.h:28
maxon::Char Char
Definition: ge_sys_math.h:47
maxon::Int32 Int32
Definition: ge_sys_math.h:51
maxon::Int Int
Definition: ge_sys_math.h:55
maxon::Url MaxonConvert(const Filename &fn, MAXONCONVERTMODE convertMode)
#define iferr_return
Definition: resultbase.h:1531