Code Examples And Extended Information - Libelium Waspmote v15 and Plug & Sense Programming Manual

Waspmote encryption libraries
Table of Contents

Advertisement

7. Code examples and extended information

In the Waspmote Development section you can find complete examples:
http://www.libelium.com/development/waspmote/examples
Example:
/*
*
------Waspmote AES_01 Encryption 128 ECB PKCS --------
*
*
This example shows how to encrypt plain text using:
*
- AES algorithm
*
- 128-bit key size
*
- PKCS Padding
*
- ECB Cipher Mode
*
*
Copyright (C) 2015 Libelium Comunicaciones Distribuidas S.L.
*
http://www.libelium.com
*
*
This program is free software: you can redistribute it and/or modify
*
it under the terms of the GNU General Public License as published by
*
the Free Software Foundation, either version 2 of the License, or
*
(at your option) any later version.
*
*
This program is distributed in the hope that it will be useful,
*
but WITHOUT ANY WARRANTY; without even the implied warranty of
*
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
GNU General Public License for more details.
*
*
You should have received a copy of the GNU General Public License
*
along with this program.
*
*
Version:
*
Design:
*
Implementation:
*/
#include "WaspAES.h"
// Define a 16-Byte (AES-128) private key to encrypt message
char password[] = "libeliumlibelium";
// original message on which the algorithm will be applied
char message[] = "This_is_a_message";
// Variable for encrypted message's length
uint16_t encrypted_length;
// Declaration of variable encrypted message
uint8_t encrypted_message[300];
void setup()
{
// init USB port
USB.ON();
USB.println(F("AES_01 example:"));
USB.println(F("- 128-bit Key Size"));
USB.println(F("- ECB Cipher Mode"));
USB.println(F("- PKCS5 padding"));
USB.println();
USB.print(F("\nOriginal message:"));
If not, see <http://www.gnu.org/licenses/>.
0.4
David Gascón
Alvaro Gonzalez, Yuri Carmona
-20-
Code examples and extended information
See the
v7.0

Advertisement

Table of Contents
loading

Table of Contents