summaryrefslogtreecommitdiff
path: root/paramiko/client.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2017-05-26 20:42:22 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2017-06-03 02:02:46 -0400
commitb03ebb2d64ec87da589d6fcfa4f1c00ead40c1a7 (patch)
tree11b2dea580a680cd0f9f40e1c29a375b898f64e1 /paramiko/client.py
parent7326702b0fc7bcdf2a811acb46d042deed6f2947 (diff)
downloadparamiko-b03ebb2d64ec87da589d6fcfa4f1c00ead40c1a7.tar.gz
Fixes #325 -- add support for Ed25519 keys
Diffstat (limited to 'paramiko/client.py')
-rw-r--r--paramiko/client.py35
1 files changed, 16 insertions, 19 deletions
diff --git a/paramiko/client.py b/paramiko/client.py
index 8325d90f..42b52712 100644
--- a/paramiko/client.py
+++ b/paramiko/client.py
@@ -32,6 +32,7 @@ from paramiko.common import DEBUG
from paramiko.config import SSH_PORT
from paramiko.dsskey import DSSKey
from paramiko.ecdsakey import ECDSAKey
+from paramiko.ed25519key import Ed25519Key
from paramiko.hostkeys import HostKeys
from paramiko.py3compat import string_types
from paramiko.resource import ResourceManager
@@ -586,25 +587,21 @@ class SSHClient (ClosingContextManager):
if not two_factor:
keyfiles = []
- rsa_key = os.path.expanduser('~/.ssh/id_rsa')
- dsa_key = os.path.expanduser('~/.ssh/id_dsa')
- ecdsa_key = os.path.expanduser('~/.ssh/id_ecdsa')
- if os.path.isfile(rsa_key):
- keyfiles.append((RSAKey, rsa_key))
- if os.path.isfile(dsa_key):
- keyfiles.append((DSSKey, dsa_key))
- if os.path.isfile(ecdsa_key):
- keyfiles.append((ECDSAKey, ecdsa_key))
- # look in ~/ssh/ for windows users:
- rsa_key = os.path.expanduser('~/ssh/id_rsa')
- dsa_key = os.path.expanduser('~/ssh/id_dsa')
- ecdsa_key = os.path.expanduser('~/ssh/id_ecdsa')
- if os.path.isfile(rsa_key):
- keyfiles.append((RSAKey, rsa_key))
- if os.path.isfile(dsa_key):
- keyfiles.append((DSSKey, dsa_key))
- if os.path.isfile(ecdsa_key):
- keyfiles.append((ECDSAKey, ecdsa_key))
+
+ for keytype, path in [
+ (RSAKey, "rsa"),
+ (DSSKey, "dsa"),
+ (ECDSAKey, "ecdsa"),
+ (Ed25519Key, "ed25519"),
+ ]:
+ full_path = os.path.expanduser("~/.ssh/id_%s" % path)
+ if os.path.isfile(full_path):
+ keyfiles.append((keytype, full_path))
+
+ # look in ~/ssh/ for windows users:
+ full_path = os.path.expanduser("~/ssh/id_%s" % path)
+ if os.path.isfile(full_path):
+ keyfiles.append((keytype, full_path))
if not look_for_keys:
keyfiles = []