Libelium Waspmote v15 and Plug & Sense Programming Manual page 21

Waspmote encryption libraries
Table of Contents

Advertisement

USB.println(message);
USB.print(F("Original length:"));
USB.println((int)strlen(message));
USB.println();
}
void loop()
{
////////////////////////////////////////////////////////////////
// 1. Encrypt message
////////////////////////////////////////////////////////////////
USB.println(F("1. Encrypt message"));
// 1.1. Calculate length in Bytes of the encrypted message
encrypted_length = AES.sizeOfBlocks(message);
// 1.2. Calculate encrypted message with ECB cipher mode and PKCS5 padding.
AES.encrypt(
AES_128
, password
, message
, encrypted_message
, ECB
, PKCS5);
// 1.3. Printing encrypted message
USB.print(F("AES Encrypted message:"));
AES.printMessage( encrypted_message, encrypted_length);
// 1.4. Printing encrypted message's length
USB.print(F("AES Encrypted length:"));
USB.println( (int)encrypted_length);
USB.println();
delay(5000);
USB.println(F("***********************"));
}
Code examples and extended information
-21-
v7.0

Advertisement

Table of Contents
loading

Table of Contents