Merge pull request #2078 from alex/ssh-load-coverage

Improvemed branch coverage for ssh public key loading
This commit is contained in:
Paul Kehrer 2015-06-27 14:12:05 -05:00
commit 7e1fc28ded
2 changed files with 6 additions and 8 deletions

View file

@ -685,8 +685,7 @@ class Backend(object):
def generate_dsa_parameters(self, key_size):
if key_size not in (1024, 2048, 3072):
raise ValueError(
"Key size must be 1024 or 2048 or 3072 bits.")
raise ValueError("Key size must be 1024 or 2048 or 3072 bits.")
if (self._lib.OPENSSL_VERSION_NUMBER < 0x1000000f and
key_size > 1024):

View file

@ -106,12 +106,11 @@ def _load_ssh_ecdsa_public_key(expected_key_type, decoded_data, backend):
if rest:
raise ValueError('Key body contains extra bytes.')
if curve_name == b"nistp256":
curve = ec.SECP256R1()
elif curve_name == b"nistp384":
curve = ec.SECP384R1()
elif curve_name == b"nistp521":
curve = ec.SECP521R1()
curve = {
b"nistp256": ec.SECP256R1,
b"nistp384": ec.SECP384R1,
b"nistp521": ec.SECP521R1,
}[curve_name]()
if six.indexbytes(data, 0) != 4:
raise NotImplementedError(