3

I have this issue on Ubuntu 18.04 in the Docker. When I develop this app on macOS there is no such error.

I build image with this Dockerfile: https://pastebin.com/rG32a0dv

requirements.txt:

Flask==1.0.2
uWSGI==2.0.17.1
Authlib==0.10
cryptography==2.3.1

Usage in code:

header = {'alg': 'RS256'}
payload = {'login': login}

auth_token = jwt.encode(header, payload, private_key)

and

try:
    claims = jwt.decode(auth_token, public_key)
except BadSignatureError:
    return False

Whole the Flask app: https://pastebin.com/9vVJQL1w

And I have the error:

authlib.specs.rfc7515.errors.UnsupportedAlgorithmError: unsupported_algorithm:

Details: https://pastebin.com/MjFRce1F

Why this error appears? What can I do to fix it?

andre487
  • 1,261
  • 2
  • 18
  • 27
  • 1
    Can you post the context of your code? We can only guess what jwt is and how it has been created. Can you confirm that the cryptography package is installed in the docker image? – mg. Oct 28 '18 at 08:49
  • I have updated the description of the question. I have added whole the code of application. And I have added cryptography in requirements.txt – andre487 Oct 28 '18 at 08:56

1 Answers1

1

cryptography has no manylinux wheels for CPython 3.7. In this case, you need to build cryptography on linux yourself. Follow the documentation:

https://cryptography.io/en/latest/installation/#building-cryptography-on-linux

You can try import some cryptography modules to verify:

from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric.utils import (
    decode_dss_signature, encode_dss_signature
)
from cryptography.hazmat.primitives.asymmetric.ec import ECDSA
from cryptography.hazmat.primitives.asymmetric import padding

via https://github.com/lepture/authlib/blob/v0.10/authlib/specs/rfc7518/_backends/_jws_cryptography.py

lepture
  • 2,307
  • 16
  • 18