summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--paramiko/pkey.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/paramiko/pkey.py b/paramiko/pkey.py
index f2447e15..0464795a 100644
--- a/paramiko/pkey.py
+++ b/paramiko/pkey.py
@@ -307,8 +307,8 @@ class PKey(object):
start += 1
m = self.BEGIN_TAG.match(lines[start])
start += 1
- keytype = m.group(1)
- if start >= len(lines):
+ keytype = m.group(1) if m else None
+ if start >= len(lines) or keytype is None:
raise SSHException("not a valid " + tag + " private key file")
# find the END tag