AES, what specification?

On 30/03/2017 at 04:48, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   18 
Platform:   Windows  ;   
Language(s) :     C++  ;

Hi guys,

I'm trying to generate encrypted strings using the the AES class in C4D. On its own it works fine.

The problem is, I'm trying to encrypt/decrypt that data online via php with mcrypt. The documentation in C4D simply says it's a Rijndael implementation, but there are several variants, some requiring an initialization vector which C4D doesn't seem to use.

Is there any more information on this? Worst-case is I'll have to use an external c++ library, which is a pain especially having to get them to run in both Visual Studio and XCode.


On 04/04/2017 at 11:12, xxxxxxxx wrote:


I'm sorry, I didn't provide an answer, yet. Still waiting for an answer from our development.

On 04/04/2017 at 23:00, xxxxxxxx wrote:

Thanks for the update.

Just to clarify what I'm trying to find, here's what we have from our C++ API.

aes->Init( 128, 128 );  
aes->Encrypt( string_input,  
            aes->CalcEncryptedDataSize( 128, 8 ),  
            encryption_key );  

And this is what's in PHP's mcrypt:

return mcrypt_encrypt( MCRYPT_RIJNDAEL_128,  
                       mcrypt_create_iv( mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB), MCRYPT_DEV_URANDOM));  

Similar components are the input string, the encryption key, and initialization for the encryption block size.
What's hidden in C4D's implementation is the seed for the initialization vector (randomized in mcrypt by default, but there's a way to manually set it), and the type of encryption (ECB/CBC/CFB/etc.).

I have almost zero experience with xcode, so It's way too risky/time-consuming to use a third-party encrption library for cross-platform implementation.

On 10/04/2017 at 08:14, xxxxxxxx wrote:


sorry, this took so long. The AES library in our SDK uses ECB, which does not seem to need an init vector, and we don't provide one.
Really no expert on encryption, so I'm just passing information. If anything remains unclear, just keep asking.

On 10/04/2017 at 08:27, xxxxxxxx wrote:

Ahh, that actually helps a lot. mcrypt also doesn't have init vector for ECB, so that's probably it.

I think I'll hold off on the server-side part for now. I'll release the plugin first, then I'll just do more testing and maybe add in that stuff after.

Thanks Andreas!

On 10/04/2017 at 23:05, xxxxxxxx wrote:

Small update. Confirmed that it's the same encryption.

AutoAlloc< AES > aes;  
aes->Init( 128, 128 );  
aes->Encrypt( string_input, aes->CalcEncryptedDataSize( 128, 16 ), encryption_key );  
mcrypt_encrypt( MCRYPT_RIJNDAEL_128, $encryption_key, $string_input, MCRYPT_MODE_ECB );  

Both c++ and php code return the same values.

On 10/04/2017 at 23:53, xxxxxxxx wrote:

Thanks for confirmation.