hynek / pem

PEM file parsing in Python.
https://pem.readthedocs.io/
MIT License
156 stars 37 forks source link

__repr__ is broken on Python 3 #23

Closed mithrandi closed 8 years ago

mithrandi commented 8 years ago

As far as I can tell, the intention is that _pem_str is unicode on Python 3. But __repr__ tries to pass it to hashlib.sha1 which requires bytes, thus explosions.

mithrandi commented 8 years ago

Having said that, after writing a bunch of code, it seems that dealing with "native strings" is really quite awkward, since all the cryptography APIs take bytes on both Python 2 and Python 3 :(

hynek commented 8 years ago

I think I'll (or you 🤓) add a method as_bytes() to end this misery. Native string are the devil.