Representation of an openssh-style "known hosts" file. Host
keys can be read from one or more files, and then individual hosts can be
looked up to verify server keys during SSH negotiation.
A HostKeys object can be treated like a dict; any dict lookup is
equivalent to calling
| Method Summary |
| |
__init__(self,
filename)
Create a new HostKeys object, optionally loading keys from an openssh
style host-key file. |
| |
__getitem__(self,
key)
|
| |
__setitem__(self,
key,
value)
|
| |
add(self,
hostname,
keytype,
key)
Add a host key entry to the table. |
| bool
|
check(self,
hostname,
key)
Return True if the given key is associated with the given hostname in
this dictionary. |
| |
clear(self)
Remove all host keys from the dictionary. |
| str
|
hash_host(hostname,
salt)
Return a "hashed" form of the hostname, as used by openssh
when storing hashed hostnames in the known_hosts file. (Static method)
|
| |
keys(self)
|
| |
load(self,
filename)
Read a file of known SSH host keys, in the format used by openssh. |
dict(str, PKey)
|
lookup(self,
hostname)
Find a hostkey entry for a given hostname or IP. |
| |
save(self,
filename)
Save host keys into a file, in the format used by openssh. |
| |
values(self)
|
| Inherited from DictMixin |
| |
__cmp__(self,
other)
|
| |
__contains__(self,
key)
|
| |
__iter__(self)
|
| |
__len__(self)
|
| |
__repr__(self)
|
| |
get(self,
key,
default)
|
| |
has_key(self,
key)
|
| |
items(self)
|
| |
iteritems(self)
|
| |
iterkeys(self)
|
| |
itervalues(self)
|
| |
pop(self,
key,
*args)
|
| |
popitem(self)
|
| |
setdefault(self,
key,
default)
|
| |
update(self,
other,
**kwargs)
|