JWCrypto a python module to do crypto using JSON
Wed, 15 Apr 2015 - 16:00Lately I had the need to do use some crypto in a web-like scenario, a.k.a over-HTTP(S) so I set out to look at what could be used.
Pretty quickly it came clear that the JSON Web Encryption standard proposed in the IETF JOSE Working Group would be a good fit and actually the JSON Web Signature would come useful too.
Once I was convinced this was the standard to use I tried to find out a python module that implemented it as the project I am going to use this stuff in (FreeIPA ultimately) is python based.
The only implementation I found initially (since then I've found other projects scattered over the web) was this Jose project on GitHub.
After a quick look I was not satisfied by three things:
- It is not a complete implementation of the specs
- It uses obsolete python crypto-libraries wrappers
- It is not Python3 compatible
So after some looking over the specs in details to see how much work it would entail I decided to build a python modules to implement all relevant specs myself.
The JWCrypto project is the result of a few weeks of work, complete of Documentation hosted by ReadTheDocs.
It is an almost complete implementation of the JWK, JWE, JWS and JWT specs and implements most of the algorithms defined in the JWA spec. It has been reviewed internally by a member of the Red Hat Security Team and has an extensive test suite based on the specs and the test vectors included in the JOSE WG Cookbook. It is also both Python2.7 and Python3.3 compatible!
I had a lot of fun implementing it, so if you find it useful feel free to drop me a note.