paramiko.RSAKey

Package paramiko :: Class RSAKey |
[show private | hide private]
[frames | no frames]

## Type RSAKey

    object --+
             |
          PKey --+
                 |
                RSAKey

Representation of an RSA key which can be used to sign and verify SSH2 data.

Method Summary
| ``__init__`(self, msg, data)` Create a new instance of this public key type.
| `__hash__(self)`
str | ``__str__`(self)` Return a string of an SSH `Message` made up of the public part(s) of this key.
bool | ``can_sign`(self)` Return `True` if this key has the private part necessary for signing data.
`RSAKey` | ``generate`(bits, progress_func)` Generate a new private RSA key. (Static method)
int | ``get_bits`(self)` Return the number of significant bits in this key.
str | ``get_name`(self)` Return the name of this private key implementation.
| `sign_ssh_data(self, rpool, data)`
boolean | ``verify_ssh_sig`(self, data, msg)` Given a blob of data, and an SSH message representing a signature of that data, verify that it was signed with this key.
| ``write_private_key_file`(self, filename, password)` Write private key contents into a file.
Inherited from object
| ``__delattr__`(...)` x.__delattr__('name') <==> del x.name
| ``__getattribute__`(...)` x.__getattribute__('name') <==> x.name
| ``__new__`(T, S, ...)` T.__new__(S, ...) -> a new object with type S, a subtype of T
| ``__reduce__`(...)` helper for pickle
| ``__reduce_ex__`(...)` helper for pickle
| ``__repr__`(x)` x.__repr__() <==> repr(x)
| ``__setattr__`(...)` x.__setattr__('name', value) <==> x.name = value

Instance Method Details

### __init__(self, msg=None, data=None, filename=None, password=None, vals=None) (Constructor) Create a new instance of this public key type. If `msg` is given, the key's public part(s) will be filled in from the message. If `data` is given, the key's public part(s) will be filled in from the string. Parameters: `msg` - an optional SSH `Message` containing a public key of this type. (type=`Message`) `data` - an optional string containing a public key of this type (type=str) Raises: `SSHException` - if a key cannot be created from the `data` or `msg` given, or no key was passed in. Overrides: `paramiko.PKey.__init__` (inherited documentation)

### __str__(self) (Informal representation operator) 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. Returns: string representation of an SSH key message. (type=str) Overrides: `paramiko.PKey.__str__` (inherited documentation)

### can_sign(self) Return `True` if this key has the private part necessary for signing data. Returns: `True` if this is a private key. (type=bool) Overrides: `paramiko.PKey.can_sign` (inherited documentation)

### get_bits(self) Return the number of significant bits in this key. This is useful for judging the relative security of a key. Returns: bits in the key. (type=int) Overrides: `paramiko.PKey.get_bits` (inherited documentation)

### get_name(self) Return the name of this private key implementation. Returns: name of this private key type, in SSH terminology (for example, `"ssh-rsa"`). (type=str) Overrides: `paramiko.PKey.get_name` (inherited documentation)

### verify_ssh_sig(self, data, msg) Given a blob of data, and an SSH message representing a signature of that data, verify that it was signed with this key. Parameters: `data` - the data that was signed. (type=str) `msg` - an SSH signature message (type=`Message`) Returns: `True` if the signature verifies correctly; `False` otherwise. (type=boolean) Overrides: `paramiko.PKey.verify_ssh_sig` (inherited documentation)

### write_private_key_file(self, filename, password=None) Write private key contents into a file. If the password is not `None`, the key is encrypted before writing. Parameters: `filename` - name of the file to write. (type=str) `password` - an optional password to use to encrypt the key file. (type=str) Raises: `IOError` - if there was an error writing the file. `SSHException` - if the key is invalid. Overrides: `paramiko.PKey.write_private_key_file` (inherited documentation) Since: fearow

Static Method Details

### 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. Parameters: `bits` - number of bits the generated key should be. (type=int) `progress_func` - an optional function to call at key points in key generation (used by `pyCrypto.PublicKey`). (type=function) Returns: new private key (type=`RSAKey`) Since: fearow

Generated by Epydoc 2.1 on Sun Dec 4 11:16:47 2005 | http://epydoc.sf.net