heroku / kombu-fernet-serializers

Symmetrically encrypted serializers for Kombu
MIT License
28 stars 13 forks source link

TypeError raised in Python 3 #6

Closed Pablosan closed 4 years ago

Pablosan commented 10 years ago

The cryptography package expects an instance of bytes to be sent to its Fernet.encrypt method: https://github.com/pyca/cryptography/blob/master/cryptography/fernet.py#L63

Since json.dumps is being used to serialize the data before encryption, a string is being passed to the cryptography package. In Python 2 strings are also bytes. In Python 3 they are not, so an explicit translation is required.

It appears that doing something like message.encode('utf-8') (if the Python version is 3.x) would make the cryptography package happy.

lambacck commented 4 years ago

version 0.1.0 with Python 3 support has been released to pypi