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

espsecure not encrypting .bin files #369

Closed
mau-lopez opened this issue Nov 6, 2018 · 2 comments
Closed

espsecure not encrypting .bin files #369

mau-lopez opened this issue Nov 6, 2018 · 2 comments

Comments

@mau-lopez
Copy link

Hi, I've been trying to encrypt a .bin file with espsecure v2.6-beta1 with no success. After generating a key with:

~/Developer/esp/esp-idf/components/esptool_py/esptool/espsecure.py generate_flash_encryption_key encryption_key.bin

I am running:

~/Developer/esp/esp-idf/components/esptool_py/esptool/espsecure.py encrypt_flash_data --keyfile encryption_key.bin --address 0x10000 -o ~/Developer/esp/encryptApp/build/encryptApp-encrypted.bin ~/Developer/esp/encryptApp/build/encryptApp.bin

and getting the attached output. An output file is generate, but is empty. Am I doing something wrong? any advice will be much appreciated, thanks in advance

  • Operating system: MacOS 10.14.1
  • Python version: Python 2.7
  • ESP hardware in use: Wemos ESP32 and TTGO ESP32

Full output from esptool.py (please copy and paste all lines of output)

espsecure.py v2.6-beta1
Using 256-bit key
Traceback (most recent call last):
File "/Users/mau/Developer/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 424, in
_main()
File "/Users/mau/Developer/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 417, in _main
main()
File "/Users/mau/Developer/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 412, in main
operation_func(args)
File "/Users/mau/Developer/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 332, in encrypt_flash_data
return _flash_encryption_operation(args.output, args.plaintext_file, args.address, args.keyfile, args.flash_crypt_conf, False)
File "/Users/mau/Developer/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 310, in _flash_encryption_operation
block_key = _flash_encryption_tweak_key(key, block_offs, tweak_range)
File "/Users/mau/Developer/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 269, in _flash_encryption_tweak_key
key = [ord(k) for k in key]
File "/Users/mau/Developer/esp/esp-idf/components/esptool_py/esptool/espsecure.py", line 269, in
key = [ord(k) for k in key]
TypeError: ord() expected string of length 1, but int found

What is the expected behaviour?

En encrypted file.

Do you have any other information from investigating this?

Is there any other information you can think of which will help us reproduce this problem?

I think, it might be a bug in the key generation code, not sure of course
screen shot 2018-11-05 at 21 38 05

@mau-lopez
Copy link
Author

Anyone who has experienced this issue or could help me with it? It would be much appreciated. Thanks

@projectgus
Copy link
Contributor

Hi @mau-lopez ,

Thanks for being patient while someone looked into this. The root cause was Python 3 compatibility, and it should be fixed in master branch now. Release ot come soon.

Angus

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

2 participants