Python (Raspberry PI) & C++ (Arduino) AES Encryption

  aes, arduino, byte, c++, encryption

I am currently working on a project where an Arduino and Raspberry PI will communicate with each other.
The Arduino will send sensor data to the Raspberry PI. This data needs to be encrypted with AES encryption.

The following library will be used send data encrypted from my Arduino to my Raspberry PI: https://github.com/suculent/thinx-aes-lib

In this library, the AES KEY & AES IV are set as follows:

// AES Encryption Key (same as in node-js example)
byte aes_key[] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C};

// General initialization vector (same as in node-js example) 
byte aes_iv[N_BLOCK] = { 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA };

However, I do not want to set the keys directly in my Arduino code. At the moment the raspberry PI can generate the keys to my Arduino and send this as string value. But how can I use these string values in my C++ code and set it as a key?

I am very new to programming is C++, so any help would be appreciated!

Source: Windows Questions C++

LEAVE A COMMENT