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

verify_signature report bug when using a public_key #357

Closed
human890209 opened this issue Sep 11, 2018 · 0 comments
Closed

verify_signature report bug when using a public_key #357

human890209 opened this issue Sep 11, 2018 · 0 comments

Comments

@human890209
Copy link

human890209 commented Sep 11, 2018

  • Operating system: Win10 x64
  • Python version: 3.7
  • ESP hardware in use: ESP-WROOM-32 dev board

Full esptool.py command line as run:

python espsecure.py verify_signature --keyfile public_key.pem VS_app_signed.bin

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

espsecure.py v2.5.0
Traceback (most recent call last):
File "espsecure.py", line 156, in verify_signature
sk = _load_key(args) # try to load as private key first
File "espsecure.py", line 123, in _load_key
sk = ecdsa.SigningKey.from_pem(args.keyfile.read())
File "C:\Python37\lib\site-packages\ecdsa-0.13-py3.7.egg\ecdsa\keys.py", line 159, in from_pem
privkey_pem = string[string.index(b("-----BEGIN EC PRIVATE KEY-----")):]
ValueError: subsection not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "espsecure.py", line 401, in
_main()
File "espsecure.py", line 394, in _main
main()
File "espsecure.py", line 389, in main
operation_func(args)
File "espsecure.py", line 160, in verify_signature
vk = ecdsa.VerifyingKey.from_pem(args.keyfile.read())
File "C:\Python37\lib\site-packages\ecdsa-0.13-py3.7.egg\ecdsa\keys.py", line 52, in from_pem
return klass.from_der(der.unpem(string))
File "C:\Python37\lib\site-packages\ecdsa-0.13-py3.7.egg\ecdsa\der.py", line 191, in unpem
return base64.b64decode(d)
File "C:\Python37\lib\base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

What is the expected behaviour?

Do you have any other information from investigating this?

It worked with the private key.

espsecure.py v2.5.0
Verifying 216016 bytes of data
Signature is valid

I extract_public_key from the private key with espsecure.py extract_public_key command.

espsecure.py v2.5.0
secure_boot_signing_key.pem public key extracted to public_key.pem

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

I report this issue in ESP32 forum
https://www.esp32.com/viewtopic.php?f=14&t=7138
Hope other experienced users could provide more info.
If you got any solution, please reply the post in the forum with a URL link here so that post can be solved.

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

1 participant