diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-12-15 12:30:50 -0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-12-15 12:30:50 -0800 |
commit | 0c9e8af1f43a1d37ccf46640250186e0fb42fb06 (patch) | |
tree | b858d88aff49a9f73ec57babfb964298196476a1 | |
parent | 004b3ad14d691311d6dbb48aa05901e01d681ea2 (diff) | |
download | cryptography-0c9e8af1f43a1d37ccf46640250186e0fb42fb06.tar.gz cryptography-0c9e8af1f43a1d37ccf46640250186e0fb42fb06.tar.bz2 cryptography-0c9e8af1f43a1d37ccf46640250186e0fb42fb06.zip |
Added two more tests to get coverage back up
-rw-r--r-- | tests/hazmat/primitives/test_serialization.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py index 2b9d05a7..abb55751 100644 --- a/tests/hazmat/primitives/test_serialization.py +++ b/tests/hazmat/primitives/test_serialization.py @@ -692,7 +692,7 @@ class TestSSHSerialization(object): load_ssh_public_key(ssh_key, backend) def test_load_ssh_public_key_bad_format(self, backend): - ssh_key = b'not-a-real-key' + ssh_key = b'not-a-real-key text' with pytest.raises(ValueError): load_ssh_public_key(ssh_key, backend) @@ -746,6 +746,22 @@ class TestSSHSerialization(object): with pytest.raises(ValueError): load_ssh_public_key(ssh_key, backend) + def test_load_ssh_public_key_rsa_different_string(self, backend): + ssh_key = ( + # "AAAAB3NzA" the final A is capitalized here to cause the string + # ssh-rsa inside the base64 encoded blob to be incorrect. It should + # be a lower case 'a'. + b"ssh-rsa AAAAB3NzAC1yc2EAAAADAQABAAABAQDDu/XRP1kyK6Cgt36gts9XAk" + b"FiiuJLW6RU0j3KKVZSs1I7Z3UmU9/9aVh/rZV43WQG8jaR6kkcP4stOR0DEtll" + b"PDA7ZRBnrfiHpSQYQ874AZaAoIjgkv7DBfsE6gcDQLub0PFjWyrYQUJhtOLQEK" + b"vY/G0vt2iRL3juawWmCFdTK3W3XvwAdgGk71i6lHt+deOPNEPN2H58E4odrZ2f" + b"sxn/adpDqfb2sM0kPwQs0aWvrrKGvUaustkivQE4XWiSFnB0oJB/lKK/CKVKuy" + b"///ImSCGHQRvhwariN2tvZ6CBNSLh3iQgeB0AkyJlng7MXB2qYq/Ci2FUOryCX" + b"2MzHvnbvAQ== testkey@localhost" + ) + with pytest.raises(ValueError): + load_ssh_public_key(ssh_key, backend) + def test_load_ssh_public_key_rsa(self, backend): ssh_key = ( b"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDu/XRP1kyK6Cgt36gts9XAk" |