summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adams <mark@markadams.me>2016-10-24 13:04:53 -0500
committerGitHub <noreply@github.com>2016-10-24 13:04:53 -0500
commit18160c494af1c142e7da14996fb1342b9abaca4f (patch)
tree0dd154bc06f69e3cfc1c6e718320e8cf0f38c79e
parent01dae1c90358d2302f217e543e5dddd0d0403eee (diff)
parent89f9a9d2940d86868e9600a9e1a4c7bb342d326e (diff)
downloadpyjwt-18160c494af1c142e7da14996fb1342b9abaca4f.tar.gz
Merge pull request #219 from mike9005/es521_fix
Fix incorrectly named ECDSA algorithm
-rw-r--r--docs/algorithms.rst2
-rw-r--r--jwt/algorithms.py2
-rw-r--r--tests/test_api_jws.py8
3 files changed, 6 insertions, 6 deletions
diff --git a/docs/algorithms.rst b/docs/algorithms.rst
index 69ed575..93ae91e 100644
--- a/docs/algorithms.rst
+++ b/docs/algorithms.rst
@@ -9,7 +9,7 @@ This library currently supports:
* HS512 - HMAC using SHA-512 hash algorithm
* ES256 - ECDSA signature algorithm using SHA-256 hash algorithm
* ES384 - ECDSA signature algorithm using SHA-384 hash algorithm
-* ES512 - ECDSA signature algorithm using SHA-512 hash algorithm
+* ES521 - ECDSA signature algorithm using SHA-512 hash algorithm
* RS256 - RSASSA-PKCS1-v1_5 signature algorithm using SHA-256 hash algorithm
* RS384 - RSASSA-PKCS1-v1_5 signature algorithm using SHA-384 hash algorithm
* RS512 - RSASSA-PKCS1-v1_5 signature algorithm using SHA-512 hash algorithm
diff --git a/jwt/algorithms.py b/jwt/algorithms.py
index 3144f23..b3c92d7 100644
--- a/jwt/algorithms.py
+++ b/jwt/algorithms.py
@@ -50,7 +50,7 @@ def get_default_algorithms():
'RS512': RSAAlgorithm(RSAAlgorithm.SHA512),
'ES256': ECAlgorithm(ECAlgorithm.SHA256),
'ES384': ECAlgorithm(ECAlgorithm.SHA384),
- 'ES512': ECAlgorithm(ECAlgorithm.SHA512),
+ 'ES521': ECAlgorithm(ECAlgorithm.SHA512),
'PS256': RSAPSSAlgorithm(RSAPSSAlgorithm.SHA256),
'PS384': RSAPSSAlgorithm(RSAPSSAlgorithm.SHA384),
'PS512': RSAPSSAlgorithm(RSAPSSAlgorithm.SHA512)
diff --git a/tests/test_api_jws.py b/tests/test_api_jws.py
index 855575c..403735d 100644
--- a/tests/test_api_jws.py
+++ b/tests/test_api_jws.py
@@ -543,7 +543,7 @@ class TestJWS:
with open('tests/keys/testkey_ec', 'r') as ec_priv_file:
priv_eckey = load_pem_private_key(force_bytes(ec_priv_file.read()),
password=None, backend=default_backend())
- jws_message = jws.encode(payload, priv_eckey, algorithm='ES512')
+ jws_message = jws.encode(payload, priv_eckey, algorithm='ES521')
with open('tests/keys/testkey_ec.pub', 'r') as ec_pub_file:
pub_eckey = load_pem_public_key(force_bytes(ec_pub_file.read()), backend=default_backend())
@@ -552,7 +552,7 @@ class TestJWS:
# string-formatted key
with open('tests/keys/testkey_ec', 'r') as ec_priv_file:
priv_eckey = ec_priv_file.read()
- jws_message = jws.encode(payload, priv_eckey, algorithm='ES512')
+ jws_message = jws.encode(payload, priv_eckey, algorithm='ES521')
with open('tests/keys/testkey_ec.pub', 'r') as ec_pub_file:
pub_eckey = ec_pub_file.read()
@@ -565,11 +565,11 @@ class TestJWS:
if has_crypto:
assert 'ES256' in jws_algorithms
assert 'ES384' in jws_algorithms
- assert 'ES512' in jws_algorithms
+ assert 'ES521' in jws_algorithms
else:
assert 'ES256' not in jws_algorithms
assert 'ES384' not in jws_algorithms
- assert 'ES512' not in jws_algorithms
+ assert 'ES521' not in jws_algorithms
def test_skip_check_signature(self, jws):
token = ("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"