[Python-modules-commits] [pyjwt] 02/13: Import pyjwt_1.5.3.orig.tar.gz

Daniele Tricoli eriol-guest at moszumanska.debian.org
Sun Sep 24 22:40:42 UTC 2017


This is an automated email from the git hooks/post-receive script.

eriol-guest pushed a commit to branch master
in repository pyjwt.

commit c7ff76533842ea5d4fd0de18893dbf5a0586ec1b
Author: Daniele Tricoli <eriol at mornie.org>
Date:   Sun Sep 24 20:18:50 2017 +0200

    Import pyjwt_1.5.3.orig.tar.gz
---
 CHANGELOG.md                                       |  84 +++++-
 MANIFEST.in                                        |   2 +-
 PKG-INFO                                           | 106 +++++---
 PyJWT.egg-info/PKG-INFO                            | 106 +++++---
 PyJWT.egg-info/SOURCES.txt                         |  20 +-
 PyJWT.egg-info/entry_points.txt                    |   2 +-
 PyJWT.egg-info/requires.txt                        |   4 +-
 README.md                                          |  48 ----
 README.rst                                         |  74 ++++++
 jwt/__init__.py                                    |  10 +-
 jwt/__main__.py                                    | 205 ++++++++-------
 jwt/algorithms.py                                  | 225 ++++++++++++----
 jwt/api_jws.py                                     |  52 ++--
 jwt/api_jwt.py                                     |  30 ++-
 jwt/compat.py                                      |  28 +-
 jwt/utils.py                                       |  52 +++-
 setup.cfg                                          |   3 +-
 setup.py                                           |  18 +-
 tests/__init__.pyc                                 | Bin 0 -> 144 bytes
 .../test_algorithms.cpython-27-PYTEST.pyc          | Bin 0 -> 37431 bytes
 .../__pycache__/test_api_jws.cpython-27-PYTEST.pyc | Bin 0 -> 48805 bytes
 .../__pycache__/test_api_jwt.cpython-27-PYTEST.pyc | Bin 0 -> 29388 bytes
 tests/__pycache__/test_cli.cpython-27-PYTEST.pyc   | Bin 0 -> 9498 bytes
 .../__pycache__/test_compat.cpython-27-PYTEST.pyc  | Bin 0 -> 3445 bytes
 .../test_exceptions.cpython-27-PYTEST.pyc          | Bin 0 -> 1379 bytes
 tests/__pycache__/test_jwt.cpython-27-PYTEST.pyc   | Bin 0 -> 1593 bytes
 tests/__pycache__/test_utils.cpython-27-PYTEST.pyc | Bin 0 -> 2833 bytes
 tests/compat.pyc                                   | Bin 0 -> 338 bytes
 tests/contrib/__init__.pyc                         | Bin 0 -> 152 bytes
 .../test_algorithms.cpython-27-PYTEST.pyc          | Bin 0 -> 10838 bytes
 tests/contrib/test_algorithms.py                   |  36 +--
 tests/keys/__init__.py                             |  31 +--
 tests/keys/__init__.pyc                            | Bin 0 -> 2845 bytes
 tests/keys/testkey_ec_ssh.pub                      |   1 +
 tests/keys/testkey_pkcs1.pub.pem                   |   5 +
 tests/test_algorithms.py                           | 284 +++++++++++++++++++--
 tests/test_api_jws.py                              |  79 ++++--
 tests/test_api_jwt.py                              |  32 ++-
 tests/test_cli.py                                  | 127 +++++++++
 tests/test_compat.py                               |   9 +-
 tests/test_utils.py                                |  40 +++
 tests/utils.py                                     |  17 +-
 tests/utils.pyc                                    | Bin 0 -> 1330 bytes
 tox.ini                                            |   2 +-
 44 files changed, 1289 insertions(+), 443 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index de4b14d..1dd5a19 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,65 @@ Change Log
 All notable changes to this project will be documented in this file.
 This project adheres to [Semantic Versioning](http://semver.org/).
 
+[Unreleased][unreleased]
+-------------------------------------------------------------------------
+### Changed
+### Fixed
+### Added
+
+[v1.5.3][1.5.3]
+-------------------------------------------------------------------------
+### Changed
+
+- Increase required version of the cryptography package to >=1.4.0.
+
+### Fixed
+
+- Remove uses of deprecated functions from the cryptography package.
+- Warn about missing `algorithms` param to `decode()` only when `verify` param is `True` [#281][281]
+
+[v1.5.2][1.5.2]
+-------------------------------------------------------------------------
+### Fixed
+
+- Ensure correct arguments order in decode super call [7c1e61d][7c1e61d]
+
+[v1.5.1][1.5.1]
+-------------------------------------------------------------------------
+### Changed
+
+- Change optparse for argparse. [#238][238]
+
+### Fixed
+
+- Guard against PKCS1 PEM encododed public keys [#277][277]
+- Add deprecation warning when decoding without specifying `algorithms` [#277][277]
+- Improve deprecation messages [#270][270]
+- PyJWT.decode: move verify param into options [#271][271]
+
+### Added
+
+- Support for Python 3.6 [#262][262]
+- Expose jwt.InvalidAlgorithmError [#264][264]
+
+[v1.5.0][1.5.0]
+-------------------------------------------------------------------------
+### Changed
+- Add support for ECDSA public keys in RFC 4253 (OpenSSH) format [#244][244]
+- Renamed commandline script `jwt` to `jwt-cli` to avoid issues with the script clobbering the `jwt` module in some circumstances. [#187][187]
+- Better error messages when using an algorithm that requires the cryptography package, but it isn't available [#230][230]
+- Tokens with future 'iat' values are no longer rejected [#190][190]
+- Non-numeric 'iat' values now raise InvalidIssuedAtError instead of DecodeError
+- Remove rejection of future 'iat' claims [#252][252]
+
+### Fixed
+- Add back 'ES512' for backward compatibility (for now) [#225][225]
+- Fix incorrectly named ECDSA algorithm [#219][219]
+- Fix rpm build [#196][196]
+
+### Added
+- Add JWK support for HMAC and RSA keys [#202][202]
+
 [v1.4.2][1.4.2]
 -------------------------------------------------------------------------
 ### Fixed
@@ -89,7 +148,7 @@ rarely used. Users affected by this should upgrade to 3.3+.
 - Fixed a security vulnerability by adding support for a whitelist of allowed `alg` values `jwt.decode(algorithms=[])`. [#110][110]
 
 
-[unreleased]: https://github.com/jpadilla/pyjwt/compare/1.3.0...HEAD
+[unreleased]: https://github.com/jpadilla/pyjwt/compare/1.4.2...HEAD
 [1.0.0]: https://github.com/jpadilla/pyjwt/compare/0.4.3...1.0.0
 [1.0.1]: https://github.com/jpadilla/pyjwt/compare/1.0.0...1.0.1
 [1.0.1]: https://github.com/jpadilla/pyjwt/compare/1.0.0...1.0.1
@@ -100,8 +159,10 @@ rarely used. Users affected by this should upgrade to 3.3+.
 [1.4.0]: https://github.com/jpadilla/pyjwt/compare/1.3.0...1.4.0
 [1.4.1]: https://github.com/jpadilla/pyjwt/compare/1.4.0...1.4.1
 [1.4.2]: https://github.com/jpadilla/pyjwt/compare/1.4.1...1.4.2
-
-
+[1.5.0]: https://github.com/jpadilla/pyjwt/compare/1.4.2...1.5.0
+[1.5.1]: https://github.com/jpadilla/pyjwt/compare/1.5.0...1.5.1
+[1.5.2]: https://github.com/jpadilla/pyjwt/compare/1.5.1...1.5.2
+[1.5.3]: https://github.com/jpadilla/pyjwt/compare/1.5.2...1.5.3
 
 [109]: https://github.com/jpadilla/pyjwt/pull/109
 [110]: https://github.com/jpadilla/pyjwt/pull/110
@@ -120,4 +181,21 @@ rarely used. Users affected by this should upgrade to 3.3+.
 [174]: https://github.com/jpadilla/pyjwt/pull/174
 [182]: https://github.com/jpadilla/pyjwt/pull/182
 [183]: https://github.com/jpadilla/pyjwt/pull/183
+[190]: https://github.com/jpadilla/pyjwt/pull/190
 [213]: https://github.com/jpadilla/pyjwt/pull/214
+[244]: https://github.com/jpadilla/pyjwt/pull/244
+[202]: https://github.com/jpadilla/pyjwt/pull/202
+[252]: https://github.com/jpadilla/pyjwt/pull/252
+[225]: https://github.com/jpadilla/pyjwt/pull/225
+[219]: https://github.com/jpadilla/pyjwt/pull/219
+[196]: https://github.com/jpadilla/pyjwt/pull/196
+[187]: https://github.com/jpadilla/pyjwt/pull/187
+[230]: https://github.com/jpadilla/pyjwt/pull/230
+[238]: https://github.com/jpadilla/pyjwt/pull/238
+[262]: https://github.com/jpadilla/pyjwt/pull/262
+[264]: https://github.com/jpadilla/pyjwt/pull/264
+[270]: https://github.com/jpadilla/pyjwt/pull/270
+[271]: https://github.com/jpadilla/pyjwt/pull/271
+[277]: https://github.com/jpadilla/pyjwt/pull/277
+[281]: https://github.com/jpadilla/pyjwt/pull/281
+[7c1e61d]: https://github.com/jpadilla/pyjwt/commit/7c1e61dde27bafe16e7d1bb6e35199e778962742
diff --git a/MANIFEST.in b/MANIFEST.in
index 38dbbef..144cf63 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,4 @@
-include README.md
+include README.rst
 include CHANGELOG.md
 include LICENSE
 include AUTHORS
diff --git a/PKG-INFO b/PKG-INFO
index 75d18a9..406c49a 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,59 +1,86 @@
 Metadata-Version: 1.1
 Name: PyJWT
-Version: 1.4.2
+Version: 1.5.3
 Summary: JSON Web Token implementation in Python
 Home-page: http://github.com/jpadilla/pyjwt
-Author: José Padilla
+Author: Jose Padilla
 Author-email: hello at jpadilla.com
 License: MIT
-Description: # PyJWT
+Description-Content-Type: UNKNOWN
+Description: PyJWT
+        =====
         
-        [![travis-status-image]][travis]
-        [![appveyor-status-image]][appveyor]
-        [![pypi-version-image]][pypi]
-        [![coveralls-status-image]][coveralls]
-        [![docs-status-image]][docs]
+        .. image:: https://secure.travis-ci.org/jpadilla/pyjwt.svg?branch=master
+           :target: http://travis-ci.org/jpadilla/pyjwt?branch=master
         
-        A Python implementation of [RFC 7519][jwt-spec].
-        Original implementation was written by [@progrium][progrium].
+        .. image:: https://ci.appveyor.com/api/projects/status/h8nt70aqtwhht39t?svg=true
+           :target: https://ci.appveyor.com/project/jpadilla/pyjwt
         
-        ## Installing
+        .. image:: https://img.shields.io/pypi/v/pyjwt.svg
+           :target: https://pypi.python.org/pypi/pyjwt
         
-        ```
-        $ pip install PyJWT
-        ```
+        .. image:: https://coveralls.io/repos/jpadilla/pyjwt/badge.svg?branch=master
+           :target: https://coveralls.io/r/jpadilla/pyjwt?branch=master
         
-        ## Usage
+        .. image:: https://readthedocs.org/projects/pyjwt/badge/?version=latest
+           :target: https://pyjwt.readthedocs.io
         
-        ```python
-        >>> import jwt
-        >>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
-        'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg'
+        A Python implementation of `RFC
+        7519 <https://tools.ietf.org/html/rfc7519>`_. Original implementation
+        was written by `@progrium <https://github.com/progrium>`_.
         
-        >>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
-        {'some': 'payload'}
-        ```
+        Installing
+        ----------
         
-        ## Tests
+        Install with **pip**:
+        
+        .. code-block:: sh
+        
+            $ pip install PyJWT
+        
+        
+        Usage
+        -----
+        
+        .. code:: python
+        
+            >>> import jwt
+            >>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
+            'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg'
+        
+            >>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
+            {'some': 'payload'}
+        
+        
+        Command line
+        ------------
+        
+        Usage::
+        
+            pyjwt [options] INPUT
+        
+        Decoding examples::
+        
+            pyjwt --key=secret TOKEN
+            pyjwt --no-verify TOKEN
+        
+        See more options executing ``pyjwt --help``.
+        
+        
+        Documentation
+        -------------
+        
+        View the full docs online at https://pyjwt.readthedocs.io/en/latest/
+        
+        
+        Tests
+        -----
         
         You can run tests from the project root after cloning with:
         
-        ```
-        $ python setup.py test
-        ```
-        
-        [travis-status-image]: https://secure.travis-ci.org/jpadilla/pyjwt.svg?branch=master
-        [travis]: http://travis-ci.org/jpadilla/pyjwt?branch=master
-        [appveyor-status-image]: https://ci.appveyor.com/api/projects/status/h8nt70aqtwhht39t?svg=true
-        [appveyor]: https://ci.appveyor.com/project/jpadilla/pyjwt
-        [pypi-version-image]: https://img.shields.io/pypi/v/pyjwt.svg
-        [pypi]: https://pypi.python.org/pypi/pyjwt
-        [coveralls-status-image]: https://coveralls.io/repos/jpadilla/pyjwt/badge.svg?branch=master
-        [coveralls]: https://coveralls.io/r/jpadilla/pyjwt?branch=master
-        [docs-status-image]: https://readthedocs.org/projects/pyjwt/badge/?version=latest
-        [docs]: http://pyjwt.readthedocs.org
-        [jwt-spec]: https://tools.ietf.org/html/rfc7519
-        [progrium]: https://github.com/progrium
+        .. code-block:: sh
+        
+            $ python setup.py test
         
 Keywords: jwt json web token security signing
 Platform: UNKNOWN
@@ -67,4 +94,5 @@ Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Topic :: Utilities
diff --git a/PyJWT.egg-info/PKG-INFO b/PyJWT.egg-info/PKG-INFO
index 75d18a9..406c49a 100644
--- a/PyJWT.egg-info/PKG-INFO
+++ b/PyJWT.egg-info/PKG-INFO
@@ -1,59 +1,86 @@
 Metadata-Version: 1.1
 Name: PyJWT
-Version: 1.4.2
+Version: 1.5.3
 Summary: JSON Web Token implementation in Python
 Home-page: http://github.com/jpadilla/pyjwt
-Author: José Padilla
+Author: Jose Padilla
 Author-email: hello at jpadilla.com
 License: MIT
-Description: # PyJWT
+Description-Content-Type: UNKNOWN
+Description: PyJWT
+        =====
         
-        [![travis-status-image]][travis]
-        [![appveyor-status-image]][appveyor]
-        [![pypi-version-image]][pypi]
-        [![coveralls-status-image]][coveralls]
-        [![docs-status-image]][docs]
+        .. image:: https://secure.travis-ci.org/jpadilla/pyjwt.svg?branch=master
+           :target: http://travis-ci.org/jpadilla/pyjwt?branch=master
         
-        A Python implementation of [RFC 7519][jwt-spec].
-        Original implementation was written by [@progrium][progrium].
+        .. image:: https://ci.appveyor.com/api/projects/status/h8nt70aqtwhht39t?svg=true
+           :target: https://ci.appveyor.com/project/jpadilla/pyjwt
         
-        ## Installing
+        .. image:: https://img.shields.io/pypi/v/pyjwt.svg
+           :target: https://pypi.python.org/pypi/pyjwt
         
-        ```
-        $ pip install PyJWT
-        ```
+        .. image:: https://coveralls.io/repos/jpadilla/pyjwt/badge.svg?branch=master
+           :target: https://coveralls.io/r/jpadilla/pyjwt?branch=master
         
-        ## Usage
+        .. image:: https://readthedocs.org/projects/pyjwt/badge/?version=latest
+           :target: https://pyjwt.readthedocs.io
         
-        ```python
-        >>> import jwt
-        >>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
-        'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg'
+        A Python implementation of `RFC
+        7519 <https://tools.ietf.org/html/rfc7519>`_. Original implementation
+        was written by `@progrium <https://github.com/progrium>`_.
         
-        >>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
-        {'some': 'payload'}
-        ```
+        Installing
+        ----------
         
-        ## Tests
+        Install with **pip**:
+        
+        .. code-block:: sh
+        
+            $ pip install PyJWT
+        
+        
+        Usage
+        -----
+        
+        .. code:: python
+        
+            >>> import jwt
+            >>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
+            'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg'
+        
+            >>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
+            {'some': 'payload'}
+        
+        
+        Command line
+        ------------
+        
+        Usage::
+        
+            pyjwt [options] INPUT
+        
+        Decoding examples::
+        
+            pyjwt --key=secret TOKEN
+            pyjwt --no-verify TOKEN
+        
+        See more options executing ``pyjwt --help``.
+        
+        
+        Documentation
+        -------------
+        
+        View the full docs online at https://pyjwt.readthedocs.io/en/latest/
+        
+        
+        Tests
+        -----
         
         You can run tests from the project root after cloning with:
         
-        ```
-        $ python setup.py test
-        ```
-        
-        [travis-status-image]: https://secure.travis-ci.org/jpadilla/pyjwt.svg?branch=master
-        [travis]: http://travis-ci.org/jpadilla/pyjwt?branch=master
-        [appveyor-status-image]: https://ci.appveyor.com/api/projects/status/h8nt70aqtwhht39t?svg=true
-        [appveyor]: https://ci.appveyor.com/project/jpadilla/pyjwt
-        [pypi-version-image]: https://img.shields.io/pypi/v/pyjwt.svg
-        [pypi]: https://pypi.python.org/pypi/pyjwt
-        [coveralls-status-image]: https://coveralls.io/repos/jpadilla/pyjwt/badge.svg?branch=master
-        [coveralls]: https://coveralls.io/r/jpadilla/pyjwt?branch=master
-        [docs-status-image]: https://readthedocs.org/projects/pyjwt/badge/?version=latest
-        [docs]: http://pyjwt.readthedocs.org
-        [jwt-spec]: https://tools.ietf.org/html/rfc7519
-        [progrium]: https://github.com/progrium
+        .. code-block:: sh
+        
+            $ python setup.py test
         
 Keywords: jwt json web token security signing
 Platform: UNKNOWN
@@ -67,4 +94,5 @@ Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Topic :: Utilities
diff --git a/PyJWT.egg-info/SOURCES.txt b/PyJWT.egg-info/SOURCES.txt
index 972fb0f..1ac8284 100644
--- a/PyJWT.egg-info/SOURCES.txt
+++ b/PyJWT.egg-info/SOURCES.txt
@@ -2,7 +2,7 @@ AUTHORS
 CHANGELOG.md
 LICENSE
 MANIFEST.in
-README.md
+README.rst
 setup.cfg
 setup.py
 tox.ini
@@ -25,17 +25,33 @@ jwt/contrib/algorithms/__init__.py
 jwt/contrib/algorithms/py_ecdsa.py
 jwt/contrib/algorithms/pycrypto.py
 tests/__init__.py
+tests/__init__.pyc
 tests/compat.py
+tests/compat.pyc
 tests/test_algorithms.py
 tests/test_api_jws.py
 tests/test_api_jwt.py
+tests/test_cli.py
 tests/test_compat.py
 tests/test_exceptions.py
 tests/test_jwt.py
+tests/test_utils.py
 tests/utils.py
+tests/utils.pyc
+tests/__pycache__/test_algorithms.cpython-27-PYTEST.pyc
+tests/__pycache__/test_api_jws.cpython-27-PYTEST.pyc
+tests/__pycache__/test_api_jwt.cpython-27-PYTEST.pyc
+tests/__pycache__/test_cli.cpython-27-PYTEST.pyc
+tests/__pycache__/test_compat.cpython-27-PYTEST.pyc
+tests/__pycache__/test_exceptions.cpython-27-PYTEST.pyc
+tests/__pycache__/test_jwt.cpython-27-PYTEST.pyc
+tests/__pycache__/test_utils.cpython-27-PYTEST.pyc
 tests/contrib/__init__.py
+tests/contrib/__init__.pyc
 tests/contrib/test_algorithms.py
+tests/contrib/__pycache__/test_algorithms.cpython-27-PYTEST.pyc
 tests/keys/__init__.py
+tests/keys/__init__.pyc
 tests/keys/jwk_ec_key.json
 tests/keys/jwk_ec_pub.json
 tests/keys/jwk_hmac.json
@@ -44,6 +60,8 @@ tests/keys/jwk_rsa_pub.json
 tests/keys/testkey2_rsa.pub.pem
 tests/keys/testkey_ec
 tests/keys/testkey_ec.pub
+tests/keys/testkey_ec_ssh.pub
+tests/keys/testkey_pkcs1.pub.pem
 tests/keys/testkey_rsa
 tests/keys/testkey_rsa.cer
 tests/keys/testkey_rsa.pub
\ No newline at end of file
diff --git a/PyJWT.egg-info/entry_points.txt b/PyJWT.egg-info/entry_points.txt
index cbdf40f..78717b2 100644
--- a/PyJWT.egg-info/entry_points.txt
+++ b/PyJWT.egg-info/entry_points.txt
@@ -1,3 +1,3 @@
 [console_scripts]
-jwt = jwt.__main__:main
+pyjwt = jwt.__main__:main
 
diff --git a/PyJWT.egg-info/requires.txt b/PyJWT.egg-info/requires.txt
index 67cccf5..ab8d687 100644
--- a/PyJWT.egg-info/requires.txt
+++ b/PyJWT.egg-info/requires.txt
@@ -1,6 +1,6 @@
 
 [crypto]
-cryptography
+cryptography>=1.4
 
 [flake8]
 flake8
@@ -8,6 +8,6 @@ flake8-import-order
 pep8-naming
 
 [test]
-pytest==2.7.3
+pytest<4,>3
 pytest-cov
 pytest-runner
diff --git a/README.md b/README.md
deleted file mode 100644
index 661af15..0000000
--- a/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# PyJWT
-
-[![travis-status-image]][travis]
-[![appveyor-status-image]][appveyor]
-[![pypi-version-image]][pypi]
-[![coveralls-status-image]][coveralls]
-[![docs-status-image]][docs]
-
-A Python implementation of [RFC 7519][jwt-spec].
-Original implementation was written by [@progrium][progrium].
-
-## Installing
-
-```
-$ pip install PyJWT
-```
-
-## Usage
-
-```python
->>> import jwt
->>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
-'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg'
-
->>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
-{'some': 'payload'}
-```
-
-## Tests
-
-You can run tests from the project root after cloning with:
-
-```
-$ python setup.py test
-```
-
-[travis-status-image]: https://secure.travis-ci.org/jpadilla/pyjwt.svg?branch=master
-[travis]: http://travis-ci.org/jpadilla/pyjwt?branch=master
-[appveyor-status-image]: https://ci.appveyor.com/api/projects/status/h8nt70aqtwhht39t?svg=true
-[appveyor]: https://ci.appveyor.com/project/jpadilla/pyjwt
-[pypi-version-image]: https://img.shields.io/pypi/v/pyjwt.svg
-[pypi]: https://pypi.python.org/pypi/pyjwt
-[coveralls-status-image]: https://coveralls.io/repos/jpadilla/pyjwt/badge.svg?branch=master
-[coveralls]: https://coveralls.io/r/jpadilla/pyjwt?branch=master
-[docs-status-image]: https://readthedocs.org/projects/pyjwt/badge/?version=latest
-[docs]: http://pyjwt.readthedocs.org
-[jwt-spec]: https://tools.ietf.org/html/rfc7519
-[progrium]: https://github.com/progrium
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..1a7f93b
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,74 @@
+PyJWT
+=====
+
+.. image:: https://secure.travis-ci.org/jpadilla/pyjwt.svg?branch=master
+   :target: http://travis-ci.org/jpadilla/pyjwt?branch=master
+
+.. image:: https://ci.appveyor.com/api/projects/status/h8nt70aqtwhht39t?svg=true
+   :target: https://ci.appveyor.com/project/jpadilla/pyjwt
+
+.. image:: https://img.shields.io/pypi/v/pyjwt.svg
+   :target: https://pypi.python.org/pypi/pyjwt
+
+.. image:: https://coveralls.io/repos/jpadilla/pyjwt/badge.svg?branch=master
+   :target: https://coveralls.io/r/jpadilla/pyjwt?branch=master
+
+.. image:: https://readthedocs.org/projects/pyjwt/badge/?version=latest
+   :target: https://pyjwt.readthedocs.io
+
+A Python implementation of `RFC
+7519 <https://tools.ietf.org/html/rfc7519>`_. Original implementation
+was written by `@progrium <https://github.com/progrium>`_.
+
+Installing
+----------
+
+Install with **pip**:
+
+.. code-block:: sh
+
+    $ pip install PyJWT
+
+
+Usage
+-----
+
+.. code:: python
+
+    >>> import jwt
+    >>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
+    'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg'
+
+    >>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
+    {'some': 'payload'}
+
+
+Command line
+------------
+
+Usage::
+
+    pyjwt [options] INPUT
+
+Decoding examples::
+
+    pyjwt --key=secret TOKEN
+    pyjwt --no-verify TOKEN
+
+See more options executing ``pyjwt --help``.
+
+
+Documentation
+-------------
+
+View the full docs online at https://pyjwt.readthedocs.io/en/latest/
+
+
+Tests
+-----
+
+You can run tests from the project root after cloning with:
+
+.. code-block:: sh
+
+    $ python setup.py test
diff --git a/jwt/__init__.py b/jwt/__init__.py
index 64b2f97..090b26a 100644
--- a/jwt/__init__.py
+++ b/jwt/__init__.py
@@ -10,7 +10,7 @@ http://self-issued.info/docs/draft-jones-json-web-token-01.html
 
 
 __title__ = 'pyjwt'
-__version__ = '1.4.2'
+__version__ = '1.5.3'
 __author__ = 'José Padilla'
 __license__ = 'MIT'
 __copyright__ = 'Copyright 2015 José Padilla'
@@ -22,8 +22,8 @@ from .api_jwt import (
 )
 from .api_jws import PyJWS
 from .exceptions import (
-    InvalidTokenError, DecodeError, InvalidAudienceError,
-    ExpiredSignatureError, ImmatureSignatureError, InvalidIssuedAtError,
-    InvalidIssuerError, ExpiredSignature, InvalidAudience, InvalidIssuer,
-    MissingRequiredClaimError
+    InvalidTokenError, DecodeError, InvalidAlgorithmError,
+    InvalidAudienceError, ExpiredSignatureError, ImmatureSignatureError,
+    InvalidIssuedAtError, InvalidIssuerError, ExpiredSignature,
+    InvalidAudience, InvalidIssuer, MissingRequiredClaimError
 )
diff --git a/jwt/__main__.py b/jwt/__main__.py
index fffe212..52e7abf 100644
--- a/jwt/__main__.py
+++ b/jwt/__main__.py
@@ -2,48 +2,105 @@
 
 from __future__ import absolute_import, print_function
 
+import argparse
 import json
-import optparse
 import sys
 import time
 
-from . import DecodeError, __package__, __version__, decode, encode
+from . import DecodeError, __version__, decode, encode
 
 
-def main():
+def encode_payload(args):
+    # Try to encode
+    if args.key is None:
+        raise ValueError('Key is required when encoding. See --help for usage.')
 
-    usage = '''Encodes or decodes JSON Web Tokens based on input.
+    # Build payload object to encode
+    payload = {}
 
-  %prog [options] input
+    for arg in args.payload:
+        k, v = arg.split('=', 1)
 
-Decoding examples:
+        # exp +offset special case?
+        if k == 'exp' and v[0] == '+' and len(v) > 1:
+            v = str(int(time.time()+int(v[1:])))
 
-  %prog --key=secret json.web.token
-  %prog --no-verify json.web.token
+        # Cast to integer?
+        if v.isdigit():
+            v = int(v)
+        else:
+            # Cast to float?
+            try:
+                v = float(v)
+            except ValueError:
+                pass
 
-Encoding requires the key option and takes space separated key/value pairs
-separated by equals (=) as input. Examples:
+        # Cast to true, false, or null?
+        constants = {'true': True, 'false': False, 'null': None}
 
-  %prog --key=secret iss=me exp=1302049071
-  %prog --key=secret foo=bar exp=+10
+        if v in constants:
+            v = constants[v]
 
-The exp key is special and can take an offset to current Unix time.\
-'''
-    p = optparse.OptionParser(
-        usage=usage,
-        prog=__package__,
-        version='%s %s' % (__package__, __version__),
+        payload[k] = v
+
+    token = encode(
+        payload,
+        key=args.key,
+        algorithm=args.algorithm
     )
 
-    p.add_option(
-        '-n', '--no-verify',
-        action='store_false',
-        dest='verify',
-        default=True,
-        help='ignore signature and claims verification on decode'
+    return token.decode('utf-8')
+
+
+def decode_payload(args):
+    try:
+        if sys.stdin.isatty():
+            token = sys.stdin.read()
+        else:
+            token = args.token
+
+        token = token.encode('utf-8')
+        data = decode(token, key=args.key, verify=args.verify)
+
+        return json.dumps(data)
+
+    except DecodeError as e:
+        raise DecodeError('There was an error decoding the token: %s' % e)
+
+
+def build_argparser():
+
+    usage = '''
+    Encodes or decodes JSON Web Tokens based on input.
+
+    %(prog)s [options] <command> [options] input
+
+    Decoding examples:
+
+    %(prog)s --key=secret decode json.web.token
+    %(prog)s decode --no-verify json.web.token
+
+    Encoding requires the key option and takes space separated key/value pairs
+    separated by equals (=) as input. Examples:
+
+    %(prog)s --key=secret encode iss=me exp=1302049071
+    %(prog)s --key=secret encode foo=bar exp=+10
+
+    The exp key is special and can take an offset to current Unix time.
+    '''
+
+    arg_parser = argparse.ArgumentParser(
+        prog='pyjwt',
+        usage=usage
     )
 
-    p.add_option(
+    arg_parser.add_argument(
+        '-v', '--version',
+        action='version',
+        version='%(prog)s ' + __version__
+    )
+
+    arg_parser.add_argument(
         '--key',
         dest='key',
         metavar='KEY',
@@ -51,7 +108,7 @@ The exp key is special and can take an offset to current Unix time.\
         help='set the secret key to sign with'
     )
 
-    p.add_option(
+    arg_parser.add_argument(
         '--alg',
         dest='algorithm',
         metavar='ALG',
@@ -59,77 +116,47 @@ The exp key is special and can take an offset to current Unix time.\
         help='set crypto algorithm to sign with. default=HS256'
     )
 
-    options, arguments = p.parse_args()
+    subparsers = arg_parser.add_subparsers(
+        title='PyJWT subcommands',
+        description='valid subcommands',
+        help='additional help'
+    )
 
-    if len(arguments) > 0 or not sys.stdin.isatty():
-        if len(arguments) == 1 and (not options.verify or options.key):
-            # Try to decode
-            try:
-                if not sys.stdin.isatty():
-                    token = sys.stdin.read()
-                else:
-                    token = arguments[0]
+    # Encode subcommand
+    encode_parser = subparsers.add_parser('encode', help='use to encode a supplied payload')
 
-                token = token.encode('utf-8')
-                data = decode(token, key=options.key, verify=options.verify)
+    payload_help = """Payload to encode. Must be a space separated list of key/value
+    pairs separated by equals (=) sign."""
 
-                print(json.dumps(data))
-                sys.exit(0)
-            except DecodeError as e:
-                print(e)
-                sys.exit(1)
+    encode_parser.add_argument('payload', nargs='+', help=payload_help)
+    encode_parser.set_defaults(func=encode_payload)
 
-        # Try to encode
-        if options.key is None:
-            print('Key is required when encoding. See --help for usage.')
-            sys.exit(1)
+    # Decode subcommand
+    decode_parser = subparsers.add_parser('decode', help='use to decode a supplied JSON web token')
+    decode_parser.add_argument('token', help='JSON web token to decode.')
 
-        # Build payload object to encode
-        payload = {}
+    decode_parser.add_argument(
+        '-n', '--no-verify',
+        action='store_false',
+        dest='verify',
+        default=True,
+        help='ignore signature and claims verification on decode'
+    )
 
-        for arg in arguments:
-            try:
-                k, v = arg.split('=', 1)
+    decode_parser.set_defaults(func=decode_payload)
+
+    return arg_parser
 
-                # exp +offset special case?
-                if k == 'exp' and v[0] == '+' and len(v) > 1:
-                    v = str(int(time.time()+int(v[1:])))
 
-                # Cast to integer?
-                if v.isdigit():
-                    v = int(v)
-                else:
-                    # Cast to float?
-                    try:
-                        v = float(v)
-                    except ValueError:
-                        pass
+def main():
+    arg_parser = build_argparser()
 
-                # Cast to true, false, or null?
-                constants = {'true': True, 'false': False, 'null': None}
+    try:
+        arguments = arg_parser.parse_args(sys.argv[1:])
 
-                if v in constants:
-                    v = constants[v]
+        output = arguments.func(arguments)
 
-                payload[k] = v
-            except ValueError:
-                print('Invalid encoding input at {}'.format(arg))
-                sys.exit(1)
-
-        try:
-            token = encode(
-                payload,
-                key=options.key,
-                algorithm=options.algorithm
-            )
-
-            print(token)
-            sys.exit(0)
-        except Exception as e:
-            print(e)
-            sys.exit(1)
-    else:
-        p.print_help()
-
-if __name__ == '__main__':
-    main()
+        print(output)
+    except Exception as e:
+        print('There was an unforseen error: ', e)
+        arg_parser.print_help()
diff --git a/jwt/algorithms.py b/jwt/algorithms.py
index 51e8f16..1343688 100644
--- a/jwt/algorithms.py
+++ b/jwt/algorithms.py
@@ -1,9 +1,15 @@
 import hashlib
 import hmac
+import json
 
-from .compat import binary_type, constant_time_compare, is_string_type
+
+from .compat import constant_time_compare, string_types
 from .exceptions import InvalidKeyError
-from .utils import der_to_raw_signature, raw_to_der_signature
+from .utils import (
+    base64url_decode, base64url_encode, der_to_raw_signature,
+    force_bytes, force_unicode, from_base64url_uint, raw_to_der_signature,
+    to_base64url_uint
+)
 
 try:
     from cryptography.hazmat.primitives import hashes
@@ -11,7 +17,8 @@ try:
         load_pem_private_key, load_pem_public_key, load_ssh_public_key
     )
     from cryptography.hazmat.primitives.asymmetric.rsa import (
-        RSAPrivateKey, RSAPublicKey
+        RSAPrivateKey, RSAPublicKey, RSAPrivateNumbers, RSAPublicNumbers,
+        rsa_recover_prime_factors, rsa_crt_dmp1, rsa_crt_dmq1, rsa_crt_iqmp
     )
     from cryptography.hazmat.primitives.asymmetric.ec import (
         EllipticCurvePrivateKey, EllipticCurvePublicKey
@@ -24,6 +31,9 @@ try:
 except ImportError:
     has_crypto = False
 
+requires_cryptography = set(['RS256', 'RS384', 'RS512', 'ES256', 'ES384',
+                             'ES521', 'ES512', 'PS256', 'PS384', 'PS512'])
+
 
 def get_default_algorithms():
     """
@@ -43,7 +53,8 @@ def get_default_algorithms():
             'RS512': RSAAlgorithm(RSAAlgorithm.SHA512),
             'ES256': ECAlgorithm(ECAlgorithm.SHA256),
             'ES384': ECAlgorithm(ECAlgorithm.SHA384),
-            'ES512': ECAlgorithm(ECAlgorithm.SHA512),
+            'ES521': ECAlgorithm(ECAlgorithm.SHA512),
+            'ES512': ECAlgorithm(ECAlgorithm.SHA512),  # Backward compat for #219 fix
             'PS256': RSAPSSAlgorithm(RSAPSSAlgorithm.SHA256),
             'PS384': RSAPSSAlgorithm(RSAPSSAlgorithm.SHA384),
... 1923 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pyjwt.git



More information about the Python-modules-commits mailing list