__repr__ is broken on Python 3
mithrandi opened this issue · comments
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.
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 :(
I think I'll (or you 🤓) add a method as_bytes()
to end this misery. Native string are the devil.