#include <cryptography.h>
CryptographyStreamConversionInterface class for encrypting and decrypting. To allocate an instance of a CryptographyStreamConversionRef call StreamConversions::<<encoder/decoder>>.Create(cryptoSettings). Encoder and decoder can be of AesEncoder, AesDecoder, BlowfishEncoder, BlowfishDecoder etc. Currently supported cryptography methods are:
AES Use StreamConversions::AesEncoder.Create(cryptoSettings) as name to allocate a new instance. Block size and key size must be 128, 192 or 256 bit. The encryption and decryption are hardware accelerated if the hardware has AES instructions. key1 is the key that is used for encryption and decryption. The following modes are supported: ECB: keySize2 must be 0, key2 must be nullptr, otherwise Init will return IllegalArgumentError. CBC, PCBC, CFB, OFB: keySize2 must be blockSize, key2 must not be nullptr, otherwise Init will return IllegalArgumentError. This is the initialization vector for the chiffre. CTR: keySize2 must be 0, key2 must be nullptr, callback must be the address of an BLOCK_CIPHER_CTR_CALLBACK function, otherwise Init will return IllegalArgumentError. userData of the Encrypt and Decrypt functions are not used except for CTR mode.
Blowfish Use StreamConversions::BlowfishEncoder.Create(cryptoSettings) to allocate a class instance. Blowfish is a keyed, symmetric block cipher.
Use BlowfishLegacyEncoder/BlowfishLegacyDecoder as the name to allocate the class which is compatible to CINEMA 4D R5 - R14 blowfish. The Block size must be 64 or 2048 bit. Valid key lengths are 32 to 448 bit (must be divisible by 8). The Init() flag bit 1 enables the streaming mode which causes that identical blocks are encrypted different and so it's harder to find patterns. In this mode it's possible to call Encrypt() even if the datasize is not % blocksize. If the blocksize is 2048 bit the rest is encoded with 64 bit. the rest is unencrypted! It's exactly the behavior that cinema 4d had. It's not recommended to use that for new code anymore!
Public Member Functions | |
MAXON_METHOD Bool | IsChainingChiffre () const |
Private Member Functions | |
MAXON_INTERFACE (CryptographyStreamConversionInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.cryptographystreamconversion") | |
|
private |
MAXON_METHOD Bool IsChainingChiffre | ( | ) | const |
Checks if the algorithm is a chaining chiffre (i.e. a value that was calculated in the current block is used in the next block). For example, CBC is a chaining chiffre, whereas ECB is not a chaining chiffre.