summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--paramiko/pkey.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/paramiko/pkey.py b/paramiko/pkey.py
index f494c80e..9f9cc543 100644
--- a/paramiko/pkey.py
+++ b/paramiko/pkey.py
@@ -324,7 +324,9 @@ class PKey(object):
def _read_private_key(self, tag, f, password=None):
lines = f.readlines()
-
+ if not lines:
+ raise SSHException("no lines in {} private key file".format(tag))
+
# find the BEGIN tag
start = 0
m = self.BEGIN_TAG.match(lines[start])