summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adams <mark@markadams.me>2017-03-14 07:21:12 -0500
committerMark Adams <mark@markadams.me>2017-03-14 07:37:32 -0500
commit299d196383836e1f804ef4441365a94862e08abe (patch)
treedb483fee15d4b023aa1ebc5dbcf354f9b33e03b8
parent0a4b8ddcb3ee95fd1e91539f5976854bb42ab375 (diff)
downloadpyjwt-299d196383836e1f804ef4441365a94862e08abe.tar.gz
Add a failing test for OpenSSH-formatted ECDSA public keys
-rw-r--r--tests/keys/testkey_ec_ssh.pub1
-rw-r--r--tests/test_algorithms.py7
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/keys/testkey_ec_ssh.pub b/tests/keys/testkey_ec_ssh.pub
new file mode 100644
index 0000000..4fa3a6b
--- /dev/null
+++ b/tests/keys/testkey_ec_ssh.pub
@@ -0,0 +1 @@
+ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAFZwnA8QCdL+TiQWBSHE0XsnRJBCFkb6c2DL7+ZfCFDk9khSYh3VrVOOQ1eIrO/oOm20Gp24dvP9XQS0f5B9bLQHgGFnkydPIMaNzPUNCop17F5uHOhtuFIhmOlh3lpTjyj2ten86cCetqN12kawnRs1/iu0wsGoVgk3os6yUAHvFMFGA==
diff --git a/tests/test_algorithms.py b/tests/test_algorithms.py
index 97fdc22..11d8cd0 100644
--- a/tests/test_algorithms.py
+++ b/tests/test_algorithms.py
@@ -376,6 +376,13 @@ class TestAlgorithms:
algo.prepare_key(ec_key.read())
@pytest.mark.skipif(not has_crypto, reason='Not supported without cryptography library')
+ def test_ec_should_accept_ssh_public_key_bytes(self):
+ algo = ECAlgorithm(ECAlgorithm.SHA256)
+
+ with open(key_path('testkey_ec_ssh.pub'), 'r') as ec_key:
+ algo.prepare_key(ec_key.read())
+
+ @pytest.mark.skipif(not has_crypto, reason='Not supported without cryptography library')
def test_ec_verify_should_return_false_if_signature_invalid(self):
algo = ECAlgorithm(ECAlgorithm.SHA256)