SSH Agent interface
Client interface for using private keys from an SSH agent running on the local machine. If an SSH agent is running, this class can be used to connect to it and retreive PKey objects which can be used when attempting to authenticate to remote SSH servers.
Upon initialization, a session with the local machine’s SSH agent is opened, if one is running. If no agent is running, initialization will succeed, but get_keys will return an empty tuple.
Raises SSHException: | |
---|---|
if an SSH agent is found, but speaks an incompatible protocol |
Close the SSH agent connection.
Class proxying request as a client:
Close the current connection and terminate the agent Should be called manually
Method automatically called by AgentProxyThread.run.
Private key held in a local SSH agent. This type of key can be used for authenticating to a remote server (signing). Most other key operations work as expected.
Return True if this key has the private part necessary for signing data.
Create a key object by reading a private key from a file (or file-like) object. If the private key is encrypted and password is not None, the given password will be used to decrypt the key (otherwise PasswordRequiredException is thrown).
Parameters: | |
---|---|
Returns: | a new PKey based on the given private key |
Raises: |
|
Create a key object by reading a private key file. If the private key is encrypted and password is not None, the given password will be used to decrypt the key (otherwise PasswordRequiredException is thrown). Through the magic of Python, this factory method will exist in all subclasses of PKey (such as RSAKey or DSSKey), but is useless on the abstract PKey class.
Parameters: | |
---|---|
Returns: | a new PKey based on the given private key |
Raises: |
|
Return a base64 string containing the public part of this key. Nothing secret is revealed. This format is compatible with that used to store public key files or recognized host keys.
Returns: | a base64 string containing the public part of the key. |
---|
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 (as an int) |
---|
Return an MD5 fingerprint of the public part of this key. Nothing secret is revealed.
Returns: | a 16-byte string (binary) of the MD5 fingerprint, in SSH format. |
---|
Given a blob of data, and an SSH message representing a signature of that data, verify that it was signed with this key.
Parameters: |
|
---|---|
Returns: | True if the signature verifies correctly; False otherwise. |
Write private key contents into a file (or file-like) object. If the password is not None, the key is encrypted before writing.
Parameters: | |
---|---|
Raises: |
|
Write private key contents into a file. If the password is not None, the key is encrypted before writing.
Parameters: | |
---|---|
Raises: |
|
Class to be used when wanting to ask a local SSH Agent being asked from a remote fake agent (so use a unix socket for ex.)
Return a pair of socket object and string address.
May block!
Class in charge of communication between two channels.
Class to be used when wanting to ask a remote SSH Agent
Parameters: | t (.Transport) – Transport used for SSH Agent communication forwarding |
---|---|
Raises SSHException: | |
mostly if we lost the agent |
Terminate the agent, clean the files, close connections Should be called manually
Helper for the environnement under unix
Returns: | a dict containing the SSH_AUTH_SOCK environnement variables |
---|