Last of the info field stuff

This commit is contained in:
Jeff Forcier 2014-02-26 18:55:14 -08:00
parent 5ee1fb4781
commit dfcd904318
1 changed files with 13 additions and 18 deletions

View File

@ -154,17 +154,13 @@ def generate_key_bytes(hashclass, salt, key, nbytes):
through a secure hash into some keyworthy bytes. This specific algorithm through a secure hash into some keyworthy bytes. This specific algorithm
is used for encrypting/decrypting private key files. is used for encrypting/decrypting private key files.
:param hashclass: class from `Crypto.Hash` that can be used as a secure :param class hashclass:
hashing function (like ``MD5`` or ``SHA``). class from `Crypto.Hash` that can be used as a secure hashing function
:type hashclass: `Crypto.Hash` (like ``MD5`` or ``SHA``).
:param salt: data to salt the hash with. :param str salt: data to salt the hash with.
:type salt: string :param str key: human-entered password or passphrase.
:param key: human-entered password or passphrase. :param int nbytes: number of bytes to generate.
:type key: string :return: Key data `str`
:param nbytes: number of bytes to generate.
:type nbytes: int
:return: key data
:rtype: string
""" """
keydata = '' keydata = ''
digest = '' digest = ''
@ -185,19 +181,18 @@ def generate_key_bytes(hashclass, salt, key, nbytes):
def load_host_keys(filename): def load_host_keys(filename):
""" """
Read a file of known SSH host keys, in the format used by openssh, and Read a file of known SSH host keys, in the format used by openssh, and
return a compound dict of ``hostname -> keytype ->`` `PKey <paramiko.pkey.PKey>`. return a compound dict of ``hostname -> keytype ->`` `PKey
The hostname may be an IP address or DNS name. The keytype will be either <paramiko.pkey.PKey>`. The hostname may be an IP address or DNS name. The
``"ssh-rsa"`` or ``"ssh-dss"``. keytype will be either ``"ssh-rsa"`` or ``"ssh-dss"``.
This type of file unfortunately doesn't exist on Windows, but on posix, This type of file unfortunately doesn't exist on Windows, but on posix,
it will usually be stored in ``os.path.expanduser("~/.ssh/known_hosts")``. it will usually be stored in ``os.path.expanduser("~/.ssh/known_hosts")``.
Since 1.5.3, this is just a wrapper around `.HostKeys`. Since 1.5.3, this is just a wrapper around `.HostKeys`.
:param filename: name of the file to read host keys from :param str filename: name of the file to read host keys from
:type filename: str :return:
:return: dict of host keys, indexed by hostname and then keytype nested dict of `.PKey` objects, indexed by hostname and then keytype
:rtype: dict(hostname, dict(keytype, `PKey <paramiko.pkey.PKey>`))
""" """
from paramiko.hostkeys import HostKeys from paramiko.hostkeys import HostKeys
return HostKeys(filename) return HostKeys(filename)