How to Store Your Data Securely with the ESP32 CYD

-

Cheap Yellow Display, or CYD for short, is a handy development board that has an integrated SD card port, a 320x240px TFT LCD with a touch screen, and the ESP32.

As soon as I had the board, I transferred the

The ESP32-Tetris-With-Nintendo-64-Controller project was created by adapting the TetrisWithNunchuck project to operate with the Nintendo 64 Controller and adding the Electronic-Shelf-Label-Management-System project to it.

But I’ve made the decision to go one step further and create a sophisticated data vault that makes use of the ESP32 CYD’s capabilities. In order to accomplish this, I modified the Midbar (Teensy 4.1 Version) V3.1 firmware so that it would function with the ESP32.

I’d want to share the outcome of that effort with you right now.

You may find this instruction on Instructables as well.

ESP32–2432S028R x1 PS/2 Keyboard x1 PS/2 Port x1 Supplies
Get the development environment ready.

You must set up the Arduino IDE, install the required libraries, and locate the “User_Setup.h” file in order to flash the ESP32 CYD. All of those things may be learned how to do at randomnerdtutorials.com/cheap-yellow-display-esp32-2432s028r/.

Install Any Necessary Libraries

Use the following libraries to download the archives:

Next, either start the Arduino IDE, choose “Sketch” -> “Include Library” -> “Add.ZIP Library..” and choose each archive containing the library, or unpack the contents of each archive into the “. \Arduino\libraries” folder.

Download the firmware.

One of the following sites offers the firmware-containing archive for download:

Midbar-esp32-cyd is a project on SourceForge.net.

Northstrix/Midbar-ESP32-CYD on GitHub

Download the archive from SourceForge if the firmware is all that you require. Download the ZIP from GitHub if you would also want the project images and other code examples.

Put ESP32 Filesystem Uploader in place.

Uploading files into ESP’s filesystem is the main function of the ESP32 Filesystem Uploader. The objective of this tool in this tutorial is to upload an empty SPIFFS picture into ESP.

Get the ESP32FS-1.0.zip file from the following link: https://github.com/me-no-dev/arduino-esp32fs-plugin/releases/

After that, extract the archive’s contents into the “. \Arduino\Tools\” folder.

Restart the Arduino IDE after that.

Change To The “No OTA (2MB APP/2MB SPIFFS)” Partition Scheme.

Before proceeding with ESP32 work, change the partition scheme to “No OTA (2MB APP/2MB SPIFFS)” as the board’s firmware is too large for the default partition.

ESP32 Flash Memory Format

To prepare the Flash memory of the ESP32:

Link the PC and ESP32 CYD together;
Select “ESP32 Sketch Data Upload” from the “Tools” menu. In the pop-up box that appears, select “Yes.”
The built-in flash memory will be formatted by the application.

Make EEPROM clear.

You must first wipe the EEPROM before using Midbar.

Upload the firmware into the ESP32 from the “..\V1.0\Clear_EEPROM” folder to do this.

Produce Keys

It is essential to generate your own keys and never reuse them in order to render the computational impossibility of any illegal decryption of your data.

You are in complete control of how the keys are generated. All I can do is give you the choice to do so.

I converted one of my earlier projects to function as a random number generator; although I haven’t tested it, I think the output is “random enough.” I thus cannot promise that it is random.

Proceed at your own peril!

You may use the key generator from the Midbar (Teensy 4.1) V3.0 (which is compatible with the Midbar (Teensy 4.1 Version) V3.1) to create the keys for that version of Midbar since this version of Midbar was developed from the Midbar (Teensy 4.1 Version) V3.1, and it is compatible with its software.

Start gen.exe from the “…\V1.0\Compatible Software\Untested RNG” folder to create the Midbar keys, then choose the “Gen. keys for Midbar (Teensy 4.1) V3.0” button. You push the button, and the backdrop changes from dark gray to light gray.

Change the Firmware

Replace my keys with the ones you created after opening the “Firmware_for_ESP32.ino” file from the “…\V1.0\Firmware_for_ESP32” folder.

Additionally, you can adjust a few factors in the lines that follow:

MAX_NUM_OF_RECS 999 #define

// Maximum character count for each field in the EEPROM-stored logins

52 #define MAX_NUM_OF_CHARS_FOR_USERNAME

Maximum Number of Characters for Password 52

Maximum Number of Characters for a Website: 56

// As long as the total of the three numbers is 160, you can repartition the field sizes.

uint16_t colors[4] = { // Green, Blue, Yellow, Purple

0xfde0, 0xb81c, 0x87a0, and 0x041c

};

colors[3] const uint16_t current_inact_clr =;

stripe_on_the_right_and_oth_opts_color = const uint16_t colors[0];

const uint16_t red_color_five_six_five = 0xf940;

Incorporate the updated firmware into the ESP32 CYD.

Transfer the updated firmware to the ESP32 CYD by uploading it from the “…\V1.0\Firmware_for_ESP32” folder.

Put The Device Together

After that, all you have to do is insert a keyboard into the PS/2 connection on the board.

Try connecting the keyboard to the 5V (VIN pin) if it isn’t working.

Establish a master password.

You must first establish the master password in order to utilize the Midbar.

Without first completing the factory reset, it is impossible to modify your master password!

Because the keys to the encryption techniques are partially generated from your master password, Midbar cannot decode your data without it. In the event that the master password is incorrect, it could not even unlock.

Once you have finished typing your master password, use the PS/2 keyboard to press either the “Enter” or “ESC” key.

Following vault unlocking and reaching the main menu:

To go through the menu, press the PS/2 keyboard’s “↓” (DOWNWARDS ARROW) key.
To navigate up the menu, press the PS/2 keyboard’s “↑” (UPWARDS ARROW) key.
To access the chosen menu, press any of the PS/2 keyboard’s “Enter” keys.
To get back to the main menu while in the submenu, use the PS/2 keyboard’s “Esc” or “Backspace” keys.
As you type text into a tab:

To proceed, hit “Enter” on the PS/2 keyboard.
To stop the current operation, press the PS/2 keyboard’s “Esc” button.
Gain Advantages From The Safe Data Storage

Once Midbar is configured, you may begin to use its main feature, which is a safe data vault.

You may utilize Midbar to store phone numbers, notes, credit card information, and login passwords in the built-in Flash of the ESP32. The ESP32 EEPROM has the capacity to store two login credentials as well.

It should be noted that the following code segment defines the maximum number of characters that may fit into each field of a record saved in the EEPROM:

// Maximum character count for each field containing login information kept in EEPROM #”#define MAX_NUM_OF_CHARS_FOR_PASSWORD 52″ and “#define MAX_NUM_OF_CHARS_FOR_WEBSITE” for username and password, respectively. 56
// As long as the total of the three numbers equals 160, you can rearrange the field sizes.
This restriction has no bearing on the data kept in Flash. You should be able to enter 650 characters or more in each field there (though I wouldn’t suggest it).

In addition to its main vault features, Midbar lets you encrypt and decode texts using several encryption methods.

You will require a vault with the same cryptographic keys and master password in order to decode a string that has been encrypted using the encryption algorithms found under the “Encryption Algorithms” option. These algorithms use the keys stored in the vault memory to encrypt and decrypt data.

You may use the encryption techniques included in the “Other Options” -> “Custom Key Encryption” menu to encrypt your strings using a key you manually input during the encryption process. Afterwards, you can use the Midbar (Teensy 4.1) V3.1 or any other accessible desktop software to decode the strings, and vice versa.

Savor the outcome.

Midbar is a useful and user-friendly data vault that uses cutting-edge cryptographic techniques, including superencryption and HMAC-SHA256-based data integrity verification, to safely store your priceless data in the ESP32’s Flash memory. Furthermore, the price of this edition of Midbar is comparable to many cups of coffee, making its sophisticated features incredibly accessible.

The fact that Midbar’s source code is released under the MIT license is another noteworthy point, in my opinion. This gives you the flexibility to adjust, change, and personalize Midbar to suit your requirements and tastes. To put it another way, you don’t need permission from anybody else to modify Midbar or use it as a foundation for new projects.