Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating signing key for Secure Boot V2 throws an error (IDFGH-3887) #5786

Closed
achraf-boussaada opened this issue Aug 25, 2020 · 5 comments
Closed

Comments

@achraf-boussaada
Copy link

Environment

  • Development Kit: none
  • Module or chip used: ESP32-WROOM-32E
  • IDF version : ESP-IDF v4.3-dev-907-g6c17e3a64
  • Build System: idf.py
  • Compiler version : (crosstool-NG esp-2020r2) 8.2.0
  • Operating System: Linux
  • Using an IDE?: yes, visual code studio
  • Power Supply: USB

Problem Description

the problem here is simple and straightforward, executing:

espsecure.py generate_signing_key secure_boot_signing_key.pem --version 2

throws the following error:

espsecure.py v3.0-dev
Traceback (most recent call last):
  File "/workspace/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 826, in <module>
    _main()
  File "/workspace/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 819, in _main
    main()
  File "/workspace/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 814, in main
    operation_func(args)
  File "/workspace/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 161, in generate_signing_key
    f.write(private_key)
TypeError: a bytes-like object is required, not 'str'

NOTES:

  • Executing the same command with the --version 1 flag works without a problem

  • Despite throwing an error with --version 2, the file was created but with 0 bytes as size.

@github-actions github-actions bot changed the title Generating signing key for Secure Boot V2 throws an error Generating signing key for Secure Boot V2 throws an error (IDFGH-3887) Aug 25, 2020
@hashyaha
Copy link

I changed f.write(private_key) into f.write(private_key.encode()) in line 161 of file espsecure.py and it works.

@KonstantinKondrashov
Copy link
Collaborator

Hi @achraf-boussaada @hashyaha .This issue occurs under python3, but pytnon2 works well. We will fix this.

@KonstantinKondrashov
Copy link
Collaborator

The fix is already in the master of esptool repo but was not updated in ESP-IDF. espressif/esptool@c67e079. We will update it ASAP.

@Alvin1Zhang
Copy link
Collaborator

Thanks for reporting, and sorry for slow turnaround. The fix is available at 46b3a6d. Feel free to reopen.

@pedros89
Copy link

pedros89 commented Nov 5, 2021

Hi @achraf-boussaada @hashyaha .This issue occurs under python3, but pytnon2 works well. We will fix this.

Hello, yes use python2 to always launch espsecure.py
You will have to install some modules, it is all exmplained here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants