Exscript.key module

Represents a private key.

class Exscript.key.PrivateKey(keytype='rsa')[source]

Bases: future.types.newobject.newobject

Represents a cryptographic key, and may be used to authenticate useing Exscript.protocols.

__init__(keytype='rsa')[source]

Constructor. Supported key types are provided by their respective protocol adapters and can be retrieved from the PrivateKey.keytypes class attribute.

Parameters:keytype (string) – The key type.
static from_file(filename, password='', keytype=None)[source]

Returns a new PrivateKey instance with the given attributes. If keytype is None, we attempt to automatically detect the type.

Parameters:
  • filename (string) – The key file name.
  • password (string) – The key password.
  • keytype (string) – The key type.
Return type:

PrivateKey

Returns:

The new key.

get_filename()[source]

Returns the name of the key file.

Return type:string
Returns:The key password.
get_password()[source]

Returns the password for the key.

Return type:string
Returns:The key password.
get_type()[source]

Returns the type of the key, e.g. RSA or DSA.

Return type:string
Returns:The key type
keytypes = set([u'dss', u'rsa'])
set_filename(filename)[source]

Sets the name of the key file to use.

Parameters:filename (string) – The key filename.
set_password(password)[source]

Defines the password used for decrypting the key.

Parameters:password (string) – The key password.