summaryrefslogtreecommitdiff
path: root/paramiko
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2014-02-26 14:29:07 -0800
committerJeff Forcier <jeff@bitprophet.org>2014-02-26 14:29:07 -0800
commit3f34ea48dbb5d0666f61a3e7db2504615e677757 (patch)
treeb50769c51398e56ebdf94bdca59320ff772a2d67 /paramiko
parent8ddaac24ae746846a31153b8b93c275b30de8f0d (diff)
downloadparamiko-3f34ea48dbb5d0666f61a3e7db2504615e677757.tar.gz
Bunch more info fields
Diffstat (limited to 'paramiko')
-rw-r--r--paramiko/packet.py13
-rw-r--r--paramiko/pkey.py109
-rw-r--r--paramiko/proxy.py14
-rw-r--r--paramiko/resource.py7
-rw-r--r--paramiko/rsakey.py12
5 files changed, 55 insertions, 100 deletions
diff --git a/paramiko/packet.py b/paramiko/packet.py
index 0f8152fa..397193cd 100644
--- a/paramiko/packet.py
+++ b/paramiko/packet.py
@@ -171,8 +171,6 @@ class Packetizer (object):
Returns ``True`` if a new set of keys needs to be negotiated. This
will be triggered during a packet read or write, so it should be
checked after every read or write, or at least after every few.
-
- :return: ``True`` if a new set of keys needs to be negotiated
"""
return self.__need_rekey
@@ -190,12 +188,11 @@ class Packetizer (object):
"""
Read as close to N bytes as possible, blocking as long as necessary.
- :param n: number of bytes to read
- :type n: int
- :return: the data read
- :rtype: str
- :raises EOFError: if the socket was closed before all the bytes could
- be read
+ :param int n: number of bytes to read
+ :return: the data read, as a `str`
+
+ :raises EOFError:
+ if the socket was closed before all the bytes could be read
"""
out = ''
# handle over-reading from reading the banner line
diff --git a/paramiko/pkey.py b/paramiko/pkey.py
index b412f768..ea4d2140 100644
--- a/paramiko/pkey.py
+++ b/paramiko/pkey.py
@@ -52,9 +52,8 @@ class PKey (object):
``data`` is given, the key's public part(s) will be filled in from
the string.
- :param msg:
+ :param .Message msg:
an optional SSH `.Message` containing a public key of this type.
- :type msg: `.Message`
:param str data: an optional string containing a public key of this type
:raises SSHException:
@@ -68,9 +67,6 @@ class PKey (object):
Return a string of an SSH `.Message` made up of the public part(s) of
this key. This string is suitable for passing to `__init__` to
re-create the key object later.
-
- :return: string representation of an SSH key message.
- :rtype: str
"""
return ''
@@ -81,10 +77,7 @@ class PKey (object):
of the key are compared, so a public key will compare equal to its
corresponding private key.
- :param other: key to compare to.
- :type other: `.PKey`
- :return: 0 if the two keys are equivalent, non-0 otherwise.
- :rtype: int
+ :param .Pkey other: key to compare to.
"""
hs = hash(self)
ho = hash(other)
@@ -97,9 +90,8 @@ class PKey (object):
Return the name of this private key implementation.
:return:
- name of this private key type, in SSH terminology (for example,
- ``"ssh-rsa"``).
- :rtype: str
+ name of this private key type, in SSH terminology, as a `str` (for
+ example, ``"ssh-rsa"``).
"""
return ''
@@ -108,8 +100,7 @@ class PKey (object):
Return the number of significant bits in this key. This is useful
for judging the relative security of a key.
- :return: bits in the key.
- :rtype: int
+ :return: bits in the key (as an `int`)
"""
return 0
@@ -117,9 +108,6 @@ class PKey (object):
"""
Return ``True`` if this key has the private part necessary for signing
data.
-
- :return: ``True`` if this is a private key.
- :rtype: bool
"""
return False
@@ -128,9 +116,9 @@ class PKey (object):
Return an MD5 fingerprint of the public part of this key. Nothing
secret is revealed.
- :return: a 16-byte string (binary) of the MD5 fingerprint, in SSH
+ :return:
+ a 16-byte `string <str>` (binary) of the MD5 fingerprint, in SSH
format.
- :rtype: str
"""
return MD5.new(str(self)).digest()
@@ -140,8 +128,7 @@ class PKey (object):
secret is revealed. This format is compatible with that used to store
public key files or recognized host keys.
- :return: a base64 string containing the public part of the key.
- :rtype: str
+ :return: a base64 `string <str>` containing the public part of the key.
"""
return base64.encodestring(str(self)).replace('\n', '')
@@ -150,12 +137,9 @@ class PKey (object):
Sign a blob of data with this private key, and return a `.Message`
representing an SSH signature message.
- :param rng: a secure random number generator.
- :type rng: `Crypto.Util.rng.RandomPool`
- :param data: the data to sign.
- :type data: str
- :return: an SSH signature message.
- :rtype: `.Message`
+ :param .Crypto.Util.rng.RandomPool rng: a secure random number generator.
+ :param str data: the data to sign.
+ :return: an SSH signature `message <.Message>`.
"""
return ''
@@ -164,13 +148,10 @@ class PKey (object):
Given a blob of data, and an SSH message representing a signature of
that data, verify that it was signed with this key.
- :param data: the data that was signed.
- :type data: str
- :param msg: an SSH signature message
- :type msg: `.Message`
- :return: ``True`` if the signature verifies correctly; ``False``
- otherwise.
- :rtype: boolean
+ :param str data: the data that was signed.
+ :param .Message msg: an SSH signature message
+ :return:
+ ``True`` if the signature verifies correctly; ``False`` otherwise.
"""
return False
@@ -183,13 +164,10 @@ class PKey (object):
exist in all subclasses of PKey (such as `.RSAKey` or `.DSSKey`), but
is useless on the abstract PKey class.
- :param filename: name of the file to read
- :type filename: str
- :param password: an optional password to use to decrypt the key file,
+ :param str filename: name of the file to read
+ :param str password: an optional password to use to decrypt the key file,
if it's encrypted
- :type password: str
- :return: a new key object based on the given private key
- :rtype: `.PKey`
+ :return: a new `.PKey` based on the given private key
:raises IOError: if there was an error reading the file
:raises PasswordRequiredException: if the private key file is
@@ -207,13 +185,10 @@ class PKey (object):
the given password will be used to decrypt the key (otherwise
`.PasswordRequiredException` is thrown).
- :param file_obj: the file to read from
- :type file_obj: file
- :param password: an optional password to use to decrypt the key, if it's
- encrypted
- :type password: str
- :return: a new key object based on the given private key
- :rtype: `.PKey`
+ :param file file_obj: the file to read from
+ :param str password:
+ an optional password to use to decrypt the key, if it's encrypted
+ :return: a new `.PKey` based on the given private key
:raises IOError: if there was an error reading the key
:raises PasswordRequiredException: if the private key file is encrypted,
@@ -229,10 +204,9 @@ class PKey (object):
Write private key contents into a file. If the password is not
``None``, the key is encrypted before writing.
- :param filename: name of the file to write
- :type filename: str
- :param password: an optional password to use to encrypt the key file
- :type password: str
+ :param str filename: name of the file to write
+ :param str password:
+ an optional password to use to encrypt the key file
:raises IOError: if there was an error writing the file
:raises SSHException: if the key is invalid
@@ -244,10 +218,8 @@ class PKey (object):
Write private key contents into a file (or file-like) object. If the
password is not ``None``, the key is encrypted before writing.
- :param file_obj: the file object to write into
- :type file_obj: file
- :param password: an optional password to use to encrypt the key
- :type password: str
+ :param file file_obj: the file object to write into
+ :param str password: an optional password to use to encrypt the key
:raises IOError: if there was an error writing to the file
:raises SSHException: if the key is invalid
@@ -262,15 +234,12 @@ class PKey (object):
``password`` is not ``None``, the given password will be used to decrypt
the key (otherwise `.PasswordRequiredException` is thrown).
- :param tag: ``"RSA"`` or ``"DSA"``, the tag used to mark the data block.
- :type tag: str
- :param filename: name of the file to read.
- :type filename: str
- :param password: an optional password to use to decrypt the key file,
- if it's encrypted.
- :type password: str
- :return: data blob that makes up the private key.
- :rtype: str
+ :param str tag: ``"RSA"`` or ``"DSA"``, the tag used to mark the data block.
+ :param str filename: name of the file to read.
+ :param str password:
+ an optional password to use to decrypt the key file, if it's
+ encrypted.
+ :return: data blob (`str`) that makes up the private key.
:raises IOError: if there was an error reading the file.
:raises PasswordRequiredException: if the private key file is
@@ -336,14 +305,10 @@ class PKey (object):
a trivially-encoded format (base64) which is completely insecure. If
a password is given, DES-EDE3-CBC is used.
- :param tag: ``"RSA"`` or ``"DSA"``, the tag used to mark the data block.
- :type tag: str
- :param filename: name of the file to write.
- :type filename: str
- :param data: data blob that makes up the private key.
- :type data: str
- :param password: an optional password to use to encrypt the file.
- :type password: str
+ :param str tag: ``"RSA"`` or ``"DSA"``, the tag used to mark the data block.
+ :param file filename: name of the file to write.
+ :param str data: data blob that makes up the private key.
+ :param str password: an optional password to use to encrypt the file.
:raises IOError: if there was an error writing the file.
"""
diff --git a/paramiko/proxy.py b/paramiko/proxy.py
index a977b019..30d596ba 100644
--- a/paramiko/proxy.py
+++ b/paramiko/proxy.py
@@ -39,9 +39,8 @@ class ProxyCommand(object):
Create a new CommandProxy instance. The instance created by this
class can be passed as an argument to the `.Transport` class.
- :param command_line: the command that should be executed and
- used as the proxy.
- :type command_line: str
+ :param str command_line:
+ the command that should be executed and used as the proxy.
"""
self.cmd = shlsplit(command_line)
self.process = Popen(self.cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
@@ -51,8 +50,7 @@ class ProxyCommand(object):
Write the content received from the SSH client to the standard
input of the forked command.
- :param content: string to be sent to the forked command
- :type content: str
+ :param str content: string to be sent to the forked command
"""
try:
self.process.stdin.write(content)
@@ -68,11 +66,9 @@ class ProxyCommand(object):
"""
Read from the standard output of the forked program.
- :param size: how many chars should be read
- :type size: int
+ :param int size: how many chars should be read
- :return: the length of the read content
- :rtype: int
+ :return: the length of the read content, as an `int`
"""
try:
return os.read(self.process.stdout.fileno(), size)
diff --git a/paramiko/resource.py b/paramiko/resource.py
index 8e8d9eee..9809afbe 100644
--- a/paramiko/resource.py
+++ b/paramiko/resource.py
@@ -51,10 +51,9 @@ class ResourceManager (object):
the ``resource`` will be closed by having its ``close()`` method called.
Any exceptions are ignored.
- :param obj: the object to track
- :type obj: object
- :param resource: the resource to close when the object is collected
- :type resource: object
+ :param object obj: the object to track
+ :param object resource:
+ the resource to close when the object is collected
"""
def callback(ref):
try:
diff --git a/paramiko/rsakey.py b/paramiko/rsakey.py
index c8b4daa9..8c2aae91 100644
--- a/paramiko/rsakey.py
+++ b/paramiko/rsakey.py
@@ -129,13 +129,11 @@ class RSAKey (PKey):
Generate a new private RSA key. This factory function can be used to
generate a new host key or authentication key.
- :param bits: number of bits the generated key should be.
- :type bits: int
- :param progress_func: an optional function to call at key points in
- key generation (used by ``pyCrypto.PublicKey``).
- :type progress_func: function
- :return: new private key
- :rtype: `.RSAKey`
+ :param int bits: number of bits the generated key should be.
+ :param function progress_func:
+ an optional function to call at key points in key generation (used
+ by ``pyCrypto.PublicKey``).
+ :return: new `.RSAKey` private key
"""
rsa = RSA.generate(bits, rng.read, progress_func)
key = RSAKey(vals=(rsa.e, rsa.n))