Please enable JavaScript to view this site.

Waijung 2 User Guide

Navigation: ESP32 target > Block references > Other

AES encryption block

Scroll Prev Top Next More

How this block appears in a Simulink model?

aes_encryption_block_1

What can be configured?

aes_encryption_block_2

Configuration Parameter

Selectable Option/Value

Description

Mode

--CBC--CTR--

CBC (Cipher-Block Chaining): Encrypt all as a single unit, or block, with a cipher key.

CTR (Counter mode): Each message is associated to a counter which must be unique across all messages that get encrypted with the same key.

AES Type

--Encrypt--Decrypt

Select the method that need to be used.

Note: for CTR mode it will select automatically.

Bit Size

--128--192--256--

Select the bit size of the key.

It must be 16 (AES-128), 24 (AES-192), or 32 (AES-256) bytes long.

Initialize initialization vector internally

 

To make it initialize internally.

Output buffer size

 

Enter the size of the output buffer.

Output type

--String--Hexadecimal string--

Select output type

INPUT/ OUTPUT Port

Port Name

Port Type

Date Type

Description

Key

Vector

uint8

Key is the password to used with the encryption and decryption. The array size of the key depends on the AES bit size.

* AES-128 : 16byte key

* AES-192 : 24byte key

* AES-256 : 32byte key

Message In

Scalar/Vector

uint8

Input message(encrypt/decrypt)

Message Out

Scalar/Vector

uint8

Output message(encrypt/decrypt)

IV

Vector

uint8

For user defined Initialization vector with an array size of 16 bytes

When to use this block?

AES (Advanced Encryption Standard) block can be used to encrypt and decrypt messages.

Demo

Demo file : esp32_aes_demo.slx

aes_encryption_block_3

Here is the contents under each subsystem. Two subsystems are design to categorized encryption and decryption.

aes_encryption_block_4
aes_encryption_block_5

Description

This demo will show how user can encrypt some data and convert it back to original readable text by decryption. Demo file mainly using two String_processing_block to enter the key and the message. There are two triggered subsystems activating by a step block. Each block have AES_encryption_block to do the encryption and decryption. Because of the triggered subsystem this program will execute only once(Both encrypt and the decryption). From the serial monitor user can be able to see the results of the test as in the picture bellow. Make sure the baud rate is correct(115200).

Example is only for the CBC mode. Try CTR mode also.

 

aes_encryption_block_6

 

Copyright 2024 Aimagin Co.,Ltd. Rev.1659