diff options
author | Robey Pointer <robey@lag.net> | 2004-10-18 04:54:27 +0000 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2004-10-18 04:54:27 +0000 |
commit | 2939b6936b50d207048d9e245c202c6a7c705643 (patch) | |
tree | da66e17bef235baef4a1b58f7963fdf721b737ba /demo.py | |
parent | e1639180f99a381e879b29c2ca25cbe02fe09f02 (diff) |
[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-93]
switch Transport.connect() to using a Pkey object for the host key
i suddenly realized that passing "hostkeytype" and "hostkey" as strings to
Transport.connect() was pretty silly since i went to all the effort of making
a class specifically for holding keys. so Transport.connect() now just takes
host-key argument: "hostkey" as a PKey object.
updated the demos to use PKey objects when reading the host key file, and to
use the new "hostkey" argument.
Diffstat (limited to 'demo.py')
-rwxr-xr-x | demo.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -23,7 +23,10 @@ def load_host_keys(): for host in hosts: if not keys.has_key(host): keys[host] = {} - keys[host][keytype] = base64.decodestring(key) + if keytype == 'ssh-rsa': + keys[host][keytype] = paramiko.RSAKey(data=base64.decodestring(key)) + elif keytype == 'ssh-dss': + keys[host][keytype] = paramiko.DSSKey(data=base64.decodestring(key)) f.close() return keys @@ -75,7 +78,7 @@ try: print '*** WARNING: Unknown host key!' elif not keys[hostname].has_key(key.get_name()): print '*** WARNING: Unknown host key!' - elif keys[hostname][key.get_name()] != str(key): + elif keys[hostname][key.get_name()] != key: print '*** WARNING: Host key has changed!!!' sys.exit(1) else: |