ESPTool Errors and Solutions

espsecure.py: command not found

Error Message
Error: espsecure.py: command not found

Problem

This problem occurs when the system is not able to locate the esp tool even after executing the command:
pip install esptool[hsm]
Solution
sudo find / -name espsecure.py 2>/dev/null
This command is used to find the absolute path of the esptool where the path would be /home/<username>/.local/bin/espsecure.py
Once the path is located, use this path in the signing command:
python3 /home/<username>/.local/bin/espsecure.py sign_data --version 2 --hsm --hsm-config "/home/suryanarayan.bhaskar/Downloads/SIGN+_Package_latest/FileBasedPolicy_hsm_config.ini" --output <output_file_path> <input_file_path>

Key file has length 4096 bits. Secure boot v2 only supports RSA-3072

Error Message
Error : Key file has length 4096 bits. Secure boot v2 only supports RSA-3072.

Problem

This problem occurs when the user uses a certificate which does not have a RSA-3072 key.

Solution

ESP Tool works with certificates which have RSA-3072 or ECDSA-256 keys. Configure a certificate which has RSA-3072 or ECDSA-256 keys.