AESFile Class Reference

#include <c4d_file.h>

Inheritance diagram for AESFile:

Detailed Description

File operations for AES encrypted files.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Public Member Functions

Bool Open (const Filename &name, const char *key, Int32 keylen, Int32 blocksize, UInt32 aes_flags, FILEOPEN mode=FILEOPEN::READ, FILEDIALOG error_dialog=FILEDIALOG::IGNOREOPEN, BYTEORDER order=BYTEORDER::V_MOTOROLA, Int32 type='C4DC', Int32 creator='C4D1')
 
- Public Member Functions inherited from BaseFile
Bool Open (const Filename &name, FILEOPEN mode=FILEOPEN::READ, FILEDIALOG error_dialog=FILEDIALOG::IGNOREOPEN, BYTEORDER order=BYTEORDER::V_MOTOROLA, Int32 type='C4DC', Int32 creator='C4D1')
 
Bool Close ()
 
Int ReadBytes (void *data, Int len, Bool just_try_it=false)
 
Int TryReadBytes (void *data, Int len)
 
Bool WriteBytes (const void *data, Int len)
 
Bool Seek (Int64 pos, FILESEEK mode=FILESEEK::RELATIVE_)
 
Int64 GetPosition ()
 
Int64 GetLength ()
 
LOCATION GetLocation () const
 
FILEERROR GetError () const
 
void SetError (FILEERROR error)
 
void SetOrder (BYTEORDER order)
 
Bool ReadChar (Char *v)
 
Bool ReadUChar (UChar *v)
 
Bool ReadInt16 (Int16 *v)
 
Bool ReadUInt16 (UInt16 *v)
 
Bool ReadInt32 (Int32 *v)
 
Bool ReadUInt32 (UInt32 *v)
 
Bool ReadFloat32 (Float32 *v)
 
Bool ReadFloat64 (Float64 *v)
 
Bool ReadInt64 (Int64 *v)
 
Bool ReadUInt64 (UInt64 *v)
 
Bool ReadFilename (Filename *v)
 
Bool ReadBool (Bool *v)
 
Bool ReadString (maxon::String *v)
 
Bool ReadVector32 (Vector32 *v)
 
Bool ReadVector64 (Vector64 *v)
 
Bool ReadMatrix32 (Matrix32 *v)
 
Bool ReadMatrix64 (Matrix64 *v)
 
Bool WriteChar (Char v)
 
Bool WriteUChar (UChar v)
 
Bool WriteInt16 (Int16 v)
 
Bool WriteUInt16 (UInt16 v)
 
Bool WriteInt32 (Int32 v)
 
Bool WriteUInt32 (UInt32 v)
 
Bool WriteFloat32 (Float32 v)
 
Bool WriteFloat64 (Float64 v)
 
Bool WriteInt64 (Int64 v)
 
Bool WriteUInt64 (UInt64 v)
 
Bool WriteFilename (const Filename &v)
 
Bool WriteBool (Bool v)
 
Bool WriteString (const maxon::String &v)
 
Bool WriteVector32 (const Vector32 &v)
 
Bool WriteVector64 (const Vector64 &v)
 
Bool WriteMatrix32 (const Matrix32 &v)
 
Bool WriteMatrix64 (const Matrix64 &v)
 

Static Public Member Functions

static Bool CheckEncryption (const Filename &encrypt, const Filename &decrypt, const char *key, Int32 keylen, Int32 blocksize)
 
- Static Public Member Functions inherited from BaseFile
static BaseFileAlloc ()
 
static void Free (BaseFile *&fl)
 

Private Member Functions

 AESFile ()
 
 ~AESFile ()
 

Alloc/Free

static AESFileAlloc ()
 
static void Free (AESFile *&fl)
 

Constructor & Destructor Documentation

◆ AESFile()

AESFile ( )
private

◆ ~AESFile()

~AESFile ( )
private

Member Function Documentation

◆ Alloc()

static AESFile* Alloc ( )
static

Allocates a AES file. Destroy the allocated AES file with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated AES file, or nullptr if the allocation failed.

◆ Free()

static void Free ( AESFile *&  fl)
static

Destructs AES files allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]flThe AES file to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ Open()

Bool Open ( const Filename name,
const char *  key,
Int32  keylen,
Int32  blocksize,
UInt32  aes_flags,
FILEOPEN  mode = FILEOPEN::READ,
FILEDIALOG  error_dialog = FILEDIALOG::IGNOREOPEN,
BYTEORDER  order = BYTEORDER::V_MOTOROLA,
Int32  type = 'C4DC',
Int32  creator = 'C4D1' 
)

Opens a AES encrypted file.

Warning
For a plugin to be cross platform then the type and creator parameters must be correctly filled for Mac.
Parameters
[in]nameThe name of the file to open.
[in]keyThe decryption key. The caller owns the pointed buffer.
[in]keylenThe key length. Must be 128, 192 or 256 (bits).
[in]blocksizeThe block size. Must be 128, 192 or 256 (bits).
[in]aes_flagsReserved for later use. Must be set to 0.
[in]modeThe file access mode: FILEOPEN
[in]error_dialogSets the type of error reporting that should happen during the file opening: FILEDIALOG
[in]orderThe type of byte order in the AES file: BYTEORDER
[in]typeThe type of file, only applies to Mac: MACTYPE_CINEMA.
[in]creatorThe application that wrote the file, for example 'ttxt' (SimpleText) or 'C4D1' for Cinema 4D, only relevant to Mac: MACCREATOR_CINEMA.
Returns
true if the file was opened without any problem, otherwise false.

◆ CheckEncryption()

static Bool CheckEncryption ( const Filename encrypt,
const Filename decrypt,
const char *  key,
Int32  keylen,
Int32  blocksize 
)
static

Checks if the encrypted file is the encrypted version of the decrypted file.

Parameters
[in]encryptThe filename of the encrypted file.
[in]decryptThe filename of the decrypted file.
[in]keyThe decryption key. The caller owns the pointed buffer.
[in]keylenThe key length. Must be 128, 192 or 256 (bits).
[in]blocksizeThe block size. Must be 128, 192 or 256 (bits).
Returns
true if the encrypted file is the encrypted version of the decrypted file, otherwise false.