Package com.sshtools.j2ssh.agent
Class SshAgentConnection
java.lang.Object
com.sshtools.j2ssh.agent.SshAgentConnection
- All Implemented Interfaces:
Runnable
This class provides a connection using the SSH agent protocol.
- Version:
- $Revision: 1.14 $
- Author:
- $author$
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
onAddKey
(com.sshtools.j2ssh.agent.SshAgentAddKey msg) Called when the remote side adds a key the agent.protected void
onDeleteAllKeys
(com.sshtools.j2ssh.agent.SshAgentDeleteAllKeys msg) Called when the remote side requests that all keys be removed from the agent.protected void
onDeleteKey
(com.sshtools.j2ssh.agent.SshAgentDeleteKey msg) Called by the remote side to delete a key from the agentprotected void
onForwardingNotice
(com.sshtools.j2ssh.agent.SshAgentForwardingNotice msg) Called when a forwarding notice is recceived from the remote side.protected void
onListKeys
(com.sshtools.j2ssh.agent.SshAgentListKeys msg) Called by the remote side when a list of the agents keys is requiredprotected void
onLock
(com.sshtools.j2ssh.agent.SshAgentLock msg) Called by the remote side when the agent is to be lockedprotected void
onMessageReceived
(byte[] msgdata) Process a message and route to the handler methodprotected void
onPing
(com.sshtools.j2ssh.agent.SshAgentPing msg) Called when a ping message is receivedprotected void
onPrivateKeyOp
(com.sshtools.j2ssh.agent.SshAgentPrivateKeyOp msg) Called by the remote side to initiate a private key operation.protected void
onRandom
(com.sshtools.j2ssh.agent.SshAgentRandom msg) Called when the remote side sends a random messageprotected void
onRequestVersion
(com.sshtools.j2ssh.agent.SshAgentRequestVersion msg) Called when the remote side requests the version number of this protocol.protected void
onUnlock
(com.sshtools.j2ssh.agent.SshAgentUnlock msg) Called by the remote side when the agent is to be unlockedvoid
run()
The connection threadprotected void
sendAgentAlive
(byte[] padding) Send the agent alive message.protected void
sendAgentFailure
(int errorcode) Send a failure messageprotected void
Send the agents key list to the remote side.protected void
Send a success message.protected void
Sends a subsystem message.protected void
sendOperationComplete
(byte[] data) Send the completed signing operation data.protected void
sendRandomData
(byte[] data) Send some random data to the remote side.protected void
Send the version response; this class currently implements version 2
-
Method Details
-
sendAgentSuccess
Send a success message.- Throws:
IOException
- if an IO error occurs
-
sendAgentFailure
Send a failure message- Parameters:
errorcode
- the error code of the failure- Throws:
IOException
- if an IO error occurs
-
sendVersionResponse
Send the version response; this class currently implements version 2- Throws:
IOException
- if an IO error occurs
-
sendAgentKeyList
Send the agents key list to the remote side. This supplies all the public keys.- Throws:
IOException
- if an IO error occurs
-
sendOperationComplete
Send the completed signing operation data.- Parameters:
data
- the data generating from the signing operation- Throws:
IOException
- if an IO error occurs
-
sendRandomData
Send some random data to the remote side.- Parameters:
data
- some random data- Throws:
IOException
- if an IO error occurs
-
sendAgentAlive
Send the agent alive message. This is sent to test whether the agent is still active- Parameters:
padding
- some random padding for the message- Throws:
IOException
- if an IO error occurs
-
sendMessage
Sends a subsystem message.- Parameters:
msg
- the subsystem message to send- Throws:
IOException
- if an IO error occurs
-
onForwardingNotice
protected void onForwardingNotice(com.sshtools.j2ssh.agent.SshAgentForwardingNotice msg) Called when a forwarding notice is recceived from the remote side.- Parameters:
msg
- the forwarding notice
-
onRequestVersion
protected void onRequestVersion(com.sshtools.j2ssh.agent.SshAgentRequestVersion msg) throws IOException Called when the remote side requests the version number of this protocol.- Parameters:
msg
- the version request message- Throws:
IOException
- if an IO error occurs
-
onAddKey
Called when the remote side adds a key the agent.- Parameters:
msg
- the message containing the key- Throws:
IOException
- if an IO error occurs
-
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.- Parameters:
msg
- the delete all keys message- Throws:
IOException
- if an IO error occurs
-
onListKeys
Called by the remote side when a list of the agents keys is required- Parameters:
msg
- the list all keys message- Throws:
IOException
- if an IO error occurs
-
onPrivateKeyOp
Called by the remote side to initiate a private key operation.- Parameters:
msg
- the private key operation message- Throws:
IOException
- if an IO error occurs
-
onDeleteKey
Called by the remote side to delete a key from the agent- Parameters:
msg
- the message containin the key to delete- Throws:
IOException
- if an IO error occurs
-
onLock
Called by the remote side when the agent is to be locked- Parameters:
msg
- the message containing a password- Throws:
IOException
- if an IO error occurs
-
onUnlock
Called by the remote side when the agent is to be unlocked- Parameters:
msg
- the message containin the password- Throws:
IOException
- if an IO error occurs
-
onPing
Called when a ping message is received- Parameters:
msg
- the ping message containing some padding- Throws:
IOException
- if an IO error occurs
-
onRandom
Called when the remote side sends a random message- Parameters:
msg
- the random message- Throws:
IOException
- if an IO error occurs
-
run
public void run()The connection thread -
onMessageReceived
Process a message and route to the handler method- Parameters:
msgdata
- the raw message received- Throws:
IOException
- if an IO error occurs
-