This class provides a connection using the SSH agent protocol.
onAddKey
protected void onAddKey(com.sshtools.j2ssh.agent.SshAgentAddKey msg)
throws IOException
Called when the remote side adds a key the agent.
msg
- the message containing the key
onDeleteAllKeys
protected void onDeleteAllKeys(com.sshtools.j2ssh.agent.SshAgentDeleteAllKeys msg)
throws IOException
Called when the remote side requests that all keys be removed from the
agent.
msg
- the delete all keys message
onDeleteKey
protected void onDeleteKey(com.sshtools.j2ssh.agent.SshAgentDeleteKey msg)
throws IOException
Called by the remote side to delete a key from the agent
msg
- the message containin the key to delete
onForwardingNotice
protected void onForwardingNotice(com.sshtools.j2ssh.agent.SshAgentForwardingNotice msg)
Called when a forwarding notice is recceived from the remote side.
msg
- the forwarding notice
onListKeys
protected void onListKeys(com.sshtools.j2ssh.agent.SshAgentListKeys msg)
throws IOException
Called by the remote side when a list of the agents keys is required
msg
- the list all keys message
onLock
protected void onLock(com.sshtools.j2ssh.agent.SshAgentLock msg)
throws IOException
Called by the remote side when the agent is to be locked
msg
- the message containing a password
onMessageReceived
protected void onMessageReceived(byte[] msgdata)
throws IOException
Process a message and route to the handler method
msgdata
- the raw message received
onPing
protected void onPing(com.sshtools.j2ssh.agent.SshAgentPing msg)
throws IOException
Called when a ping message is received
msg
- the ping message containing some padding
onPrivateKeyOp
protected void onPrivateKeyOp(com.sshtools.j2ssh.agent.SshAgentPrivateKeyOp msg)
throws IOException
Called by the remote side to initiate a private key operation.
msg
- the private key operation message
onRandom
protected void onRandom(com.sshtools.j2ssh.agent.SshAgentRandom msg)
throws IOException
Called when the remote side sends a random message
onRequestVersion
protected void onRequestVersion(com.sshtools.j2ssh.agent.SshAgentRequestVersion msg)
throws IOException
Called when the remote side requests the version number of this
protocol.
msg
- the version request message
onUnlock
protected void onUnlock(com.sshtools.j2ssh.agent.SshAgentUnlock msg)
throws IOException
Called by the remote side when the agent is to be unlocked
msg
- the message containin the password
run
public void run()
The connection thread
sendAgentAlive
protected void sendAgentAlive(byte[] padding)
throws IOException
Send the agent alive message. This is sent to test whether the agent is
still active
padding
- some random padding for the message
sendAgentFailure
protected void sendAgentFailure(int errorcode)
throws IOException
Send a failure message
errorcode
- the error code of the failure
sendAgentKeyList
protected void sendAgentKeyList()
throws IOException
Send the agents key list to the remote side. This supplies all the
public keys.
sendAgentSuccess
protected void sendAgentSuccess()
throws IOException
Send a success message.
sendMessage
protected void sendMessage(SubsystemMessage msg)
throws IOException
Sends a subsystem message.
msg
- the subsystem message to send
sendOperationComplete
protected void sendOperationComplete(byte[] data)
throws IOException
Send the completed signing operation data.
data
- the data generating from the signing operation
sendRandomData
protected void sendRandomData(byte[] data)
throws IOException
Send some random data to the remote side.
sendVersionResponse
protected void sendVersionResponse()
throws IOException
Send the version response; this class currently implements version 2