-14-
v7.0
Confidentiality (privacy)
// AES 128 encryption: CBC mode, ZEROS padding
uint8_t IV[16] =
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
AES.encrypt( 128,
password,
message,
encrypted_message,
CBC,
ZEROS,
IV);
}
The input message length can be any value. However,
the output message length
will be a
multiple of 16 bytes
.
The AES password is padded with zeros in the case it does not reach the proper length selected by the AES encryption function.
4.4. Printing Message
Some functions have been created to write encrypted message to the USB port.
{
// Writes the encrypted message to the USB port on Matrix format
AES.printMatrix(encrypted_message, length);
}
Example of use may be found in:
http://www.libelium.com/development/waspmote/examples/aes-01-aes128-ecb-pkcs/
http://www.libelium.com/development/waspmote/examples/aes-02-aes192-ecb-pkcs/
http://www.libelium.com/development/waspmote/examples/aes-03-aes256-ecb-pkcs/
http://www.libelium.com/development/waspmote/examples/aes-04-aes128-cbc-zeros/
http://www.libelium.com/development/waspmote/examples/aes-05-aes256-cbc-zeros/
http://www.libelium.com/development/waspmote/examples/aes-06-aes256-cbc-zeros/