Class

UserKeyManager

Extends:

This class encapsulates all operations done by clients on a user’s private keys. In practice, the client should never need a reference to a private key; instead, they grab a list of "identities" (public keys) that are available from the UserKeyManager, and then use the UserKeyManager to do various private key operations using those identities.

The UserKeyManager also uses the Agent class to encapsulate the ssh-agent. Thus, from a client’s perspective it is completely hidden whether an identity comes from the ssh-agent or from a file on disk.

Public Attributes
agent_factory The agent factory to use when a new agent instance is needed.
buffers The buffer manager to use for providing new buffer instances.
host_key_files The list of host key files that will be examined
key_existence_tester The object that will be used to test whether a given key file is readable. This object must only respond to "readable?" with one parameter, the file to test the readability of.
key_files The list of user key files that will be examined
keys The key manager instance to use for managing keys
log The logger instance to use for logging messages
Public Methods
<< Alias for #add
add Add the given key_file to the list of key files that will be used.
add_host_key Add the given key_file to the list of host key files that will be used.
clear! Clear all knowledge of any loaded user keys. This also clears the list of default identity files that are to be loaded, thus making it appropriate to use if a client wishes to NOT use the default identity files.
clear_host! Clear all knowledge of any loaded host keys. This also clears the list of default identity files that are to be loaded, thus making it appropriate to use if a client wishes to NOT use the default identity files.
finish This is used as a hint to the UserKeyManager indicating that the agent connection is no longer needed. Any other open resources may be closed at this time.
host_identities Returns an array of host identities (public keys) known to this manager. Host identities are those that identify the current host, and are used (typically) for hostbased authentication.
identities Returns an array of identities (public keys) known to this manager. The origin of the identities may be from files on disk or from an ssh-agent. Note that identities from an ssh-agent are always listed first in the array, with other identities coming after.
new Create a new UserKeyManager. By default, the manager will use the ssh-agent (if it is running).
sign Sign the given data, using the corresponding private key of the given identity. If the identity was originally obtained from an ssh-agent, then the ssh-agent will be used to sign the data, otherwise the private key for the identity will be loaded from disk (if it hasn’t been loaded already) and will then be used to sign the data.
use_agent= Toggles whether the ssh-agent will be used or not. If true, an attempt will be made to use the ssh-agent. If false, any existing connection to an agent is closed and the agent will not be used.
use_agent? Identifies whether the ssh-agent will be used or not.
Private Methods
close_agent Closes any open connection to an ssh-agent.
ensure_agent Ensures that a connection to the agent has been made, if an agent is to be used.
find_identity
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.