summaryrefslogtreecommitdiffhomepage
path: root/demos
diff options
context:
space:
mode:
Diffstat (limited to 'demos')
-rwxr-xr-xdemos/demo.py11
-rw-r--r--demos/demo_server.py12
2 files changed, 19 insertions, 4 deletions
diff --git a/demos/demo.py b/demos/demo.py
index b9bf7c3f..64539423 100755
--- a/demos/demo.py
+++ b/demos/demo.py
@@ -86,6 +86,17 @@ def manual_auth(username, hostname):
password = getpass.getpass("DSS key password: ")
key = paramiko.DSSKey.from_private_key_file(path, password)
t.auth_publickey(username, key)
+ elif auth == "ecdsa-sk":
+ default_path = os.path.join(os.environ["HOME"], ".ssh", "id_ecdsa_sk")
+ path = input("ECDA-SK key [%s]: " % default_path)
+ if len(path) == 0:
+ path = default_path
+ try:
+ key = paramiko.ECDSASkKey.from_private_key_file(path)
+ except paramiko.PasswordRequiredException:
+ password = getpass.getpass("ECDSA-SK key password: ")
+ key = paramiko.ECDSASkKey.from_private_key_file(path, password)
+ t.auth_publickey(username, key)
else:
pw = getpass.getpass("Password for %s@%s: " % (username, hostname))
t.auth_password(username, pw)
diff --git a/demos/demo_server.py b/demos/demo_server.py
index 7a175ac8..8a6b14f3 100644
--- a/demos/demo_server.py
+++ b/demos/demo_server.py
@@ -41,13 +41,17 @@ print("Read key: " + hexlify(host_key.get_fingerprint()).decode())
class Server(paramiko.ServerInterface):
# 'data' is the output of base64.b64encode(key)
# (using the "user_rsa_key" files)
- data = (
+ data_robey = (
b"AAAAB3NzaC1yc2EAAAABIwAAAIEAyO4it3fHlmGZWJaGrfeHOVY7RWO3P9M7hp"
b"fAu7jJ2d7eothvfeuoRFtJwhUmZDluRdFyhFY/hFAh76PJKGAusIqIQKlkJxMC"
b"KDqIexkgHAfID/6mqvmnSJf0b5W8v5h2pI/stOSwTQ+pxVhwJ9ctYDhRSlF0iT"
b"UWT10hcuO4Ks8="
)
- good_pub_key = paramiko.RSAKey(data=base64.decodebytes(data))
+ data = (
+ b"AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBDPB7gJZxOHIjoT7IEj4BQ3g7j69uRrmUTXLpnXCPqvEBcG4r/hio9OLyghMa7uTfk7j1yKdZ2bRs1SReJpdqccAAAAEc3NoOg=="
+ )
+ #good_pub_key = paramiko.RSAKey(data=base64.decodebytes(data))
+ good_pub_key = paramiko.ECDSASkKey(data=base64.decodebytes(data))
def __init__(self):
self.event = threading.Event()
@@ -64,7 +68,7 @@ class Server(paramiko.ServerInterface):
def check_auth_publickey(self, username, key):
print("Auth attempt with key: " + hexlify(key.get_fingerprint()).decode())
- if (username == "robey") and (key == self.good_pub_key):
+ if (username == "mikael") and (key == self.good_pub_key):
return paramiko.AUTH_SUCCESSFUL
return paramiko.AUTH_FAILED
@@ -112,7 +116,7 @@ class Server(paramiko.ServerInterface):
return True
-DoGSSAPIKeyExchange = True
+DoGSSAPIKeyExchange = False
# now connect
try: