Skip to content

VerificationError: Verification failed #13

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

Closed
evaherrada opened this issue Aug 7, 2020 · 4 comments · Fixed by #14
Closed

VerificationError: Verification failed #13

evaherrada opened this issue Aug 7, 2020 · 4 comments · Fixed by #14
Assignees

Comments

@evaherrada
Copy link
Collaborator

Here are the 3 that are failing because of a VerificationError I suspect test_sign_verify_fail is also failing. All of the following outputs are from rsa_tests.py:

Testing: <function test_sign_verify_sha256 at 0x20002de0>
7064.67: DEBUG - find_p_q(248): Finding p
7069.36: DEBUG - find_p_q(248): Finding q
Traceback (most recent call last):
  File "code.py", line 102, in <module>
  File "code.py", line 49, in test_sign_verify_sha256
  File "/lib/adafruit_rsa/pkcs1.py", line 329, in verify
VerificationError: Verification failed
Testing: <function test_sign_verify_sha384 at 0x20002e30>
6557.27: DEBUG - find_p_q(312): Finding p
6621.99: DEBUG - find_p_q(312): Finding q
Traceback (most recent call last):
  File "code.py", line 106, in <module>
  File "code.py", line 62, in test_sign_verify_sha384
  File "/lib/adafruit_rsa/pkcs1.py", line 329, in verify
VerificationError: Verification failed
Testing: <function test_sign_verify_sha512 at 0x20002e90>
6816.8: DEBUG - find_p_q(376): Finding p
6871.6: DEBUG - find_p_q(376): Finding q
Traceback (most recent call last):
  File "code.py", line 108, in <module>
  File "code.py", line 73, in test_sign_verify_sha512
  File "/lib/adafruit_rsa/pkcs1.py", line 329, in verify
VerificationError: Verification failed
@evaherrada evaherrada self-assigned this Aug 7, 2020
@evaherrada
Copy link
Collaborator Author

I'll take a look at this and see if it's something I can fix.

@evaherrada
Copy link
Collaborator Author

evaherrada commented Aug 7, 2020

I think I may have found the issue.
In verify, the two variables, expected and clearsig are compared. It makes sure they are equal. Here are expected and clearsig:

b'\x00\x01\xff\xff\xff\xff\xff\xff\xff\xff\x00010\r\x06\t`\x86H\x01e\x03\x04\x02\x01\x05\x00\x04 Q\x0e\x9c\xd0\x05\xe3b#RY\xc1\xdb\xb4\x9f\xe5I\xfax\x8ac\xb2\x955\x19_\x9d9oy\xe9\xa0['
b' \x01\xff\xff\xff\xff\xff\xff\xff\xff\x00010\r\x06\t`\x86H\x01e\x03\x04\x02\x01\x05\x00\x04 Q\x0e\x9c\xd0\x05\xe3b#RY\xc1\xdb\xb4\x9f\xe5I\xfax\x8ac\xb2\x955\x19_\x9d9oy\xe9\xa0['

So, they're the same, except that expected (the top one) has a leading 0. I'll try to find out which one is supposed to be the right one.

@evaherrada
Copy link
Collaborator Author

@brentru Do you have any input on which one I should be using?

@brentru
Copy link
Member

brentru commented Aug 7, 2020

@dherrada I'm not 100% on which one since I haven't touched this library in a while. I'd suggest comparing this against the Python3 output from the library which this is based on, https://github.com/sybrenstuvel/python-rsa, and verifying.

@evaherrada evaherrada linked a pull request Aug 7, 2020 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants