diff options
Diffstat (limited to 'paramiko/rsakey.py')
-rw-r--r-- | paramiko/rsakey.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/paramiko/rsakey.py b/paramiko/rsakey.py index 9db9f343..7ccf601d 100644 --- a/paramiko/rsakey.py +++ b/paramiko/rsakey.py @@ -22,8 +22,6 @@ L{RSAKey} """ -import base64 - from Crypto.PublicKey import RSA from Crypto.Hash import SHA, MD5 from Crypto.Cipher import DES3 @@ -133,6 +131,18 @@ class RSAKey (PKey): self._write_private_key_file('RSA', filename, str(b), password) def generate(bits, progress_func=None): + """ + 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 bites: int + @param progress_func: an optional function to call at key points in + key generation (used by L{pyCrypto.PublicKey}). + @type progress_func: function + @return: new private key + @rtype: L{RSAKey} + """ rsa = RSA.generate(bits, randpool.get_bytes, progress_func) key = RSAKey() key.n = rsa.n |