diff --git a/tests/blank_rsa.key b/tests/blank_rsa.key new file mode 100644 diff --git a/tests/test_pkey.py b/tests/test_pkey.py index da3278219748a3d163c58b697712d2b6402d7fa6_dGVzdHMvdGVzdF9wa2V5LnB5..91d6f61f5a442bac68719b9c355bcf3629c47a23_dGVzdHMvdGVzdF9wa2V5LnB5 100644 --- a/tests/test_pkey.py +++ b/tests/test_pkey.py @@ -184,6 +184,11 @@ with pytest.raises(SSHException, match=str(exception)): RSAKey.from_private_key_file(_support("test_rsa.key")) + def test_loading_empty_keys_errors_usefully(self): + # #1599 - raise SSHException instead of IndexError + with pytest.raises(SSHException, match="no lines"): + RSAKey.from_private_key_file(_support("blank_rsa.key")) + def test_load_rsa_password(self): key = RSAKey.from_private_key_file( _support("test_rsa_password.key"), "television"