{ "info": { "author": "Brian J Brennan", "author_email": "brianloveswords@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Topic :: Utilities" ], "description": "python-jws\n=====\nA Python implementation of [JSON Web Signatures draft 02](http://self-issued.info/docs/draft-jones-json-web-signature.html)\n\nAlso now works on Python 3.3+ as well as Python 2.7+. However, it's a naive conversion to support both Python 2 and Python 3 so there may well be hidden bugs.\n\nInstalling\n----------\n $ pip install jws\n\n\n\nAlgorithms\n----------\nThe JWS spec reserves several algorithms for cryptographic signing. Out of the 9, this library currently supports 7:\n\n\n**HMAC** \u2013 native\n\n* HS256 \u2013 HMAC using SHA-256 hash algorithm\n* HS384 \u2013 HMAC using SHA-384 hash algorithm\n* HS512 \u2013 HMAC using SHA-512 hash algorithm\n\n\n**RSA** \u2013 requires pycrypto >= 2.5: ``pip install pycrypto``\n\n* RS256 \u2013 RSA using SHA-256 hash algorithm\n\n**ECDSA** \u2013 requires ecdsa lib: ``pip install ecdsa``\n\n* ES256 \u2013 ECDSA using P-256 curve and SHA-256 hash algorithm\n* ES384 \u2013 ECDSA using P-384 curve and SHA-384 hash algorithm\n* ES512 \u2013 ECDSA using P-521 curve and SHA-512 hash algorithm\n\nThere is also a mechanism for extending functionality by adding your own\nalgorithms without cracking open the whole codebase. See the advanced usage\nsection for an example.\n\nFor RSA and ECDSA, all crypto libraries are lazily loaded so you won't need the dependencies unless you try to use the functionality.\n\nUsage\n-----\nLet's check out some examples.\n\n >>> import jws\n >>> header = { 'alg': 'HS256' }\n >>> payload = { 'claim': 'JSON is the raddest.', 'iss': 'brianb' }\n >>> signature = jws.sign(header, payload, 'secret')\n >>> jws.verify(header, payload, signature, 'secret')\n True\n >>> jws.verify(header, payload, signature, 'badbadbad')\n Traceback (most recent call last):\n ...\n jws.exceptions.SignatureError: Could not validate signature\n\nNow with a real key!\n\n >>> import ecdsa\n >>> sk256 = ecdsa.SigningKey.generate(curve=ecdsa.NIST256p)\n >>> vk = sk256.get_verifying_key()\n >>> header = { 'alg': 'ES256' }\n >>> sig = jws.sign(header, payload, sk256)\n >>> jws.verify(header, payload, sig, vk)\n True\n\nAdvanced Usage\n--------------\nMake this file\n\n # file: sillycrypto.py\n import jws\n from jws.algos import AlgorithmBase, SignatureError\n class FXUY(AlgorithmBase):\n def __init__(self, x, y):\n self.x = int(x)\n self.y = int(y)\n def sign(self, msg, key):\n return 'verysecure' * self.x + key * self.y\n\n def verify(self, msg, sig, key):\n if sig != self.sign(msg, key):\n raise SignatureError('nope')\n return True\n\n jws.algos.CUSTOM += [\n # a regular expression with two named matching groups. (x and y)\n # named groups will be sent to the class constructor\n (r'^F(?P\\d)U(?P\\d{2})$', FXUY),\n ]\n\nAnd in an interpreter:\n\n >>> import jws\n >>> header = { 'alg': 'F7U12' }\n >>> payload = { 'claim': 'wutt' }\n >>> sig = jws.sign(header, payload, '')\n Traceback (most recent call last):\n ....\n jws.exceptions.AlgorithmNotImplemented: \"F7U12\" not implemented.\n >>>\n >>> import sillycrypto\n >>> sig = jws.sign(header, payload, '')\n >>> jws.verify(header, payload, sig, '')\n True\n >>> jws.verify(header, payload, sig, 'y u no verify?')\n Traceback (most recent call last):\n ....\n jws.exceptions.SignatureError: nope\n\n\nOther Stuff\n---------\n\nCheck out\nhttps://github.com/brianloveswords/python-jws/blob/master/examples/minijwt.py\nfor a 14-line implemention of JWT.\n\nSee\nhttps://github.com/brianloveswords/python-jws/blob/master/examples/ragecrypto.py\nfor a rage-comic inspired cryptography extension.\n\nTODO\n-------\n* Write about all the rad stuff that can be done around headers (as extensible as crypto algos)\n* Pull in JWK support\n\n\nTests\n-----\n\nuse nosetests\n\nLicense\n-------\n\nMIT", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/brianloveswords/python-jws", "keywords": "jws json web security signing", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "jws", "package_url": "https://pypi.org/project/jws/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/jws/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/brianloveswords/python-jws" }, "release_url": "https://pypi.org/project/jws/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "JSON Web Signatures implementation in Python", "version": "0.1.3" }, "last_serial": 3192840, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "69f0dada8f102af6ca1c66d79338d1d7", "sha256": "ab97b5cf1b2d87c4b24cb419b277055a786e8b791f2c48dbed61ebc66681cb0f" }, "downloads": -1, "filename": "jws-0.1.0.tar.gz", "has_sig": false, "md5_digest": "69f0dada8f102af6ca1c66d79338d1d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7835, "upload_time": "2013-08-08T00:48:21", "url": "https://files.pythonhosted.org/packages/3c/74/9b1cfc1d4bf740cbd1fdccc33a5bb367d0cc3193d150399621f7a09ebf6f/jws-0.1.0.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "3692b266201d83c4ecb5f1c418d155d2", "sha256": "381cd248c4ee8ed85b216fe3c2ee7c866f516d674f44410cfb56b816fa8f6ff8" }, "downloads": -1, "filename": "jws-0.1.2.macosx-10.9-x86_64.exe", "has_sig": false, "md5_digest": "3692b266201d83c4ecb5f1c418d155d2", "packagetype": "bdist_wininst", "python_version": "any", "requires_python": null, "size": 75135, "upload_time": "2014-01-27T23:30:33", "url": "https://files.pythonhosted.org/packages/6c/dd/13c38ca7678296fa683aaf252f49b7051ca5e80c2160de5389cd9ae21fb4/jws-0.1.2.macosx-10.9-x86_64.exe" }, { "comment_text": "", "digests": { "md5": "932647ec85d7f6b5981863f23bde6cc9", "sha256": "97896acba0884456ca775e1909193f621b9ab6ba17808f9b186f06e6320d17aa" }, "downloads": -1, "filename": "jws-0.1.2.tar.gz", "has_sig": false, "md5_digest": "932647ec85d7f6b5981863f23bde6cc9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7963, "upload_time": "2014-01-27T23:30:29", "url": "https://files.pythonhosted.org/packages/9f/f2/977ce514709da6ab18c318bd5f567f5ae1334395778131377b06cc30ec00/jws-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "30aa0844df8d4c2d479266d5f0b4e2b6", "sha256": "8f9c25d7022a9592fe4766612db729e7f5ee2afbc8d409108ef11f26b0aa94b6" }, "downloads": -1, "filename": "jws-0.1.3-py2.6.egg", "has_sig": false, "md5_digest": "30aa0844df8d4c2d479266d5f0b4e2b6", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 19911, "upload_time": "2015-03-10T15:53:44", "url": "https://files.pythonhosted.org/packages/35/7d/7da8847ad5b7ec79528abd72dce38bd98c01070ca4a42cd120b5a933aff6/jws-0.1.3-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "4e3afb1e9a47b44217f3803c0bae702f", "sha256": "6f48d610bbd0d6974ce0c010a6ce0438d3fa87539e68c5e21ea28d29a8df0e57" }, "downloads": -1, "filename": "jws-0.1.3-py2.7.egg", "has_sig": false, "md5_digest": "4e3afb1e9a47b44217f3803c0bae702f", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 19894, "upload_time": "2015-03-10T15:53:50", "url": "https://files.pythonhosted.org/packages/dd/67/dfa27efe338d526ca2a7b3633fada977959091808e9f22b7df08388a9d81/jws-0.1.3-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "276cd194ed5164f3a97d286fca4ca0bc", "sha256": "1c435117e2f6842e74e9a167df58cbab20f36aa14996ccbc81b7aded2f09a704" }, "downloads": -1, "filename": "jws-0.1.3-py3.4.egg", "has_sig": false, "md5_digest": "276cd194ed5164f3a97d286fca4ca0bc", "packagetype": "bdist_egg", "python_version": "3.4", "requires_python": null, "size": 20635, "upload_time": "2015-03-10T15:53:58", "url": "https://files.pythonhosted.org/packages/c9/7f/d9ab4b0c6fbd9b3420b332bbdd707ed7823a47bd5b717dd4c5ab7ab91837/jws-0.1.3-py3.4.egg" }, { "comment_text": "", "digests": { "md5": "2d1dbd8dde4d2965b425add86963fa6e", "sha256": "0e3d4cb06ae7c5c1d16d357b4e7acb5c5ecab0cccb3a4b998035b85052488053" }, "downloads": -1, "filename": "jws-0.1.3.tar.gz", "has_sig": false, "md5_digest": "2d1dbd8dde4d2965b425add86963fa6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8104, "upload_time": "2015-03-10T15:53:37", "url": "https://files.pythonhosted.org/packages/01/9e/1536d578ed50f5fe8196310ddcc921a3cd8e973312d60ac74488b805d395/jws-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "30aa0844df8d4c2d479266d5f0b4e2b6", "sha256": "8f9c25d7022a9592fe4766612db729e7f5ee2afbc8d409108ef11f26b0aa94b6" }, "downloads": -1, "filename": "jws-0.1.3-py2.6.egg", "has_sig": false, "md5_digest": "30aa0844df8d4c2d479266d5f0b4e2b6", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 19911, "upload_time": "2015-03-10T15:53:44", "url": "https://files.pythonhosted.org/packages/35/7d/7da8847ad5b7ec79528abd72dce38bd98c01070ca4a42cd120b5a933aff6/jws-0.1.3-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "4e3afb1e9a47b44217f3803c0bae702f", "sha256": "6f48d610bbd0d6974ce0c010a6ce0438d3fa87539e68c5e21ea28d29a8df0e57" }, "downloads": -1, "filename": "jws-0.1.3-py2.7.egg", "has_sig": false, "md5_digest": "4e3afb1e9a47b44217f3803c0bae702f", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 19894, "upload_time": "2015-03-10T15:53:50", "url": "https://files.pythonhosted.org/packages/dd/67/dfa27efe338d526ca2a7b3633fada977959091808e9f22b7df08388a9d81/jws-0.1.3-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "276cd194ed5164f3a97d286fca4ca0bc", "sha256": "1c435117e2f6842e74e9a167df58cbab20f36aa14996ccbc81b7aded2f09a704" }, "downloads": -1, "filename": "jws-0.1.3-py3.4.egg", "has_sig": false, "md5_digest": "276cd194ed5164f3a97d286fca4ca0bc", "packagetype": "bdist_egg", "python_version": "3.4", "requires_python": null, "size": 20635, "upload_time": "2015-03-10T15:53:58", "url": "https://files.pythonhosted.org/packages/c9/7f/d9ab4b0c6fbd9b3420b332bbdd707ed7823a47bd5b717dd4c5ab7ab91837/jws-0.1.3-py3.4.egg" }, { "comment_text": "", "digests": { "md5": "2d1dbd8dde4d2965b425add86963fa6e", "sha256": "0e3d4cb06ae7c5c1d16d357b4e7acb5c5ecab0cccb3a4b998035b85052488053" }, "downloads": -1, "filename": "jws-0.1.3.tar.gz", "has_sig": false, "md5_digest": "2d1dbd8dde4d2965b425add86963fa6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8104, "upload_time": "2015-03-10T15:53:37", "url": "https://files.pythonhosted.org/packages/01/9e/1536d578ed50f5fe8196310ddcc921a3cd8e973312d60ac74488b805d395/jws-0.1.3.tar.gz" } ] }