[project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-15]

random doc/comment tweaks
This commit is contained in:
Robey Pointer 2005-06-28 03:44:25 +00:00
parent c0b22a3aec
commit 81ba7dccef
6 changed files with 7 additions and 18 deletions

View File

@ -1,5 +1,3 @@
#!/usr/bin/python
# Copyright (C) 2003-2005 Robey Pointer <robey@lag.net> # Copyright (C) 2003-2005 Robey Pointer <robey@lag.net>
# #
# This file is part of paramiko. # This file is part of paramiko.
@ -127,7 +125,7 @@ class PKey (object):
secret is revealed. secret is revealed.
@return: a 16-byte string (binary) of the MD5 fingerprint, in SSH @return: a 16-byte string (binary) of the MD5 fingerprint, in SSH
format. format.
@rtype: str @rtype: str
""" """
return MD5.new(str(self)).digest() return MD5.new(str(self)).digest()
@ -286,7 +284,6 @@ class PKey (object):
cipher = self._CIPHER_TABLE[encryption_type]['cipher'] cipher = self._CIPHER_TABLE[encryption_type]['cipher']
keysize = self._CIPHER_TABLE[encryption_type]['keysize'] keysize = self._CIPHER_TABLE[encryption_type]['keysize']
mode = self._CIPHER_TABLE[encryption_type]['mode'] mode = self._CIPHER_TABLE[encryption_type]['mode']
# this confusing line turns something like '2F91' into '/\x91' (sorry, was feeling clever)
salt = util.unhexify(saltstr) salt = util.unhexify(saltstr)
key = util.generate_key_bytes(MD5, salt, password, keysize) key = util.generate_key_bytes(MD5, salt, password, keysize)
return cipher.new(key, mode, salt).decrypt(data) return cipher.new(key, mode, salt).decrypt(data)

View File

@ -1,5 +1,3 @@
#!/usr/bin/python
# Copyright (C) 2003-2005 Robey Pointer <robey@lag.net> # Copyright (C) 2003-2005 Robey Pointer <robey@lag.net>
# #
# This file is part of paramiko. # This file is part of paramiko.
@ -90,11 +88,11 @@ class RSAKey (PKey):
def verify_ssh_sig(self, data, msg): def verify_ssh_sig(self, data, msg):
if msg.get_string() != 'ssh-rsa': if msg.get_string() != 'ssh-rsa':
return False return False
sig = util.inflate_long(msg.get_string(), 1) sig = util.inflate_long(msg.get_string(), True)
# verify the signature by SHA'ing the data and encrypting it using the # verify the signature by SHA'ing the data and encrypting it using theŒ
# public key. some wackiness ensues where we "pkcs1imify" the 20-byte # public key. some wackiness ensues where we "pkcs1imify" the 20-byte
# hash into a string as long as the RSA key. # hash into a string as long as the RSA key.
hash = util.inflate_long(self._pkcs1imify(SHA.new(data).digest()), 1) hash = util.inflate_long(self._pkcs1imify(SHA.new(data).digest()), True)
rsa = RSA.construct((long(self.n), long(self.e))) rsa = RSA.construct((long(self.n), long(self.e)))
return rsa.verify(hash, (sig,)) return rsa.verify(hash, (sig,))
@ -117,7 +115,7 @@ class RSAKey (PKey):
@param bits: number of bits the generated key should be. @param bits: number of bits the generated key should be.
@type bits: int @type bits: int
@param progress_func: an optional function to call at key points in @param progress_func: an optional function to call at key points in
key generation (used by C{pyCrypto.PublicKey}). key generation (used by C{pyCrypto.PublicKey}).
@type progress_func: function @type progress_func: function
@return: new private key @return: new private key
@rtype: L{RSAKey} @rtype: L{RSAKey}

View File

@ -250,7 +250,7 @@ class ServerInterface (object):
The default implementation always returns C{False}. The default implementation always returns C{False}.
@param channel: the L{Channel} the pty request arrived on. @param channel: the L{Channel} the request arrived on.
@type channel: L{Channel} @type channel: L{Channel}
@return: C{True} if this channel is now hooked up to a shell; C{False} @return: C{True} if this channel is now hooked up to a shell; C{False}
if a shell can't or won't be provided. if a shell can't or won't be provided.

View File

@ -1,5 +1,3 @@
#!/usr/bin/python
# Copyright (C) 2003-2005 Robey Pointer <robey@lag.net> # Copyright (C) 2003-2005 Robey Pointer <robey@lag.net>
# #
# This file is part of paramiko. # This file is part of paramiko.

View File

@ -1,5 +1,3 @@
#!/usr/bin/python
# Copyright (C) 2003-2005 Robey Pointer <robey@lag.net> # Copyright (C) 2003-2005 Robey Pointer <robey@lag.net>
# #
# This file is part of paramiko. # This file is part of paramiko.

View File

@ -1,5 +1,3 @@
#!/usr/bin/python
# Copyright (C) 2003-2005 Robey Pointer <robey@lag.net> # Copyright (C) 2003-2005 Robey Pointer <robey@lag.net>
# #
# This file is part of paramiko. # This file is part of paramiko.
@ -147,7 +145,7 @@ def generate_key_bytes(hashclass, salt, key, nbytes):
is used for encrypting/decrypting private key files. is used for encrypting/decrypting private key files.
@param hashclass: class from L{Crypto.Hash} that can be used as a secure @param hashclass: class from L{Crypto.Hash} that can be used as a secure
hashing function (like C{MD5} or C{SHA}). hashing function (like C{MD5} or C{SHA}).
@type hashclass: L{Crypto.Hash} @type hashclass: L{Crypto.Hash}
@param salt: data to salt the hash with. @param salt: data to salt the hash with.
@type salt: string @type salt: string