Home / Learn Chip Programming / ESP32 Security: Secure Boot, Flash Encryption, TLS

ESP32 Security: Secure Boot, Flash Encryption, TLS

Protect firmware, keys and communication in a connected device.

In shortProtect firmware, keys and communication in a connected device.

Theory in plain words

Defence layersSecure boot: only signed firmware runsFlash encryption: dumping flash gives gibberishTLS with certificate checks: no eavesdropping or spoofingPer-device unique keys and credentialsDisable JTAG and download mode in production
Defence layers

What it is

Secure boot verifies a signature on the bootloader and app. Flash encryption encrypts flash contents with a key held in eFuse. NVS encryption protects stored secrets. TLS protects network traffic.

Why we use it

Connected devices get attacked. Stolen Wi-Fi credentials or cloned firmware hurt customers and companies.

How it works

Generate a signing key, enable secure boot v2 and flash encryption in menuconfig (release mode burns eFuses, irreversible), use mbedTLS with certificate pinning, never hard-code secrets.

Where it is used

  • Commercial IoT products
  • Medical and industrial devices
  • Preventing cloning

Threat checklist

Check your product against common attacksTry it Yourself

Tick the protections your project already has. Anything unchecked is a realistic attack path.

Careful:Burning secure boot and flash encryption eFuses in release mode is permanent. Test every step in development mode on a spare board first, and keep your signing key backed up in a safe place.

Quick quiz

1. Which feature stops unsigned firmware?

2. Where should Wi-Fi passwords not be?

Common questions

Which feature stops unsigned firmware?

Secure boot. The ROM verifies the signature.

Where should Wi-Fi passwords not be?

Hard-coded in the source on GitHub. Source code leaks.