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

fix pycrypto to fit pycryptodome #434

Closed
wants to merge 1 commit into from

Conversation

sot528
Copy link

@sot528 sot528 commented Aug 1, 2019

When I use pyjwt with PyCryptodome, I got an error.

AttributeError: module 'Crypto.PublicKey.RSA' has no attribute '_RSAobj'

Traceback (most recent call last):
  File "tmp.py", line 19, in <module>
    audience='dj00aiZpPW9MRGxxxxxxxxxxxxxxxxxxxxxxx-',
  File "/foo/bar/venv/lib/python3.6/site-packages/jwt/api_jwt.py", line 92, in decode
    jwt, key=key, algorithms=algorithms, options=options, **kwargs
  File "/foo/bar/venv/lib/python3.6/site-packages/jwt/api_jws.py", line 156, in decode
    key, algorithms)
  File "/foo/bar/venv/lib/python3.6/site-packages/jwt/api_jws.py", line 220, in _verify_signature
    key = alg_obj.prepare_key(key)
  File "/foo/bar/venv/lib/python3.6/site-packages/jwt/contrib/algorithms/pycrypto.py", line 29, in prepare_key
    if isinstance(key, RSA._RSAobj):

It because of un compatibility between PyCrypto with PyCryptodome.
So I fixed it.

@coveralls
Copy link

coveralls commented Aug 1, 2019

Pull Request Test Coverage Report for Build 66

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 76.741%

Totals Coverage Status
Change from base Build 62: 0.0%
Covered Lines: 551
Relevant Lines: 718

💛 - Coveralls

@jpadilla
Copy link
Owner

jpadilla commented Aug 8, 2019

@sot528 any chance you could add a test or two to document the original problem and solution?

Also, this might also be a good idea to make sure we have official support for pycryptodome just like we do for cryptography.

@jpadilla
Copy link
Owner

Addressing this in #470

@jpadilla jpadilla closed this Dec 27, 2019
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 this pull request may close these issues.

3 participants