Package com.sshtools.agent.openssh
Class OpenSSHAgentConnection
java.lang.Object
com.sshtools.agent.openssh.OpenSSHAgentConnection
- All Implemented Interfaces:
SshAgentConnection
,Runnable
Represents a single connection on the agent server.
-
Constructor Summary
ConstructorsConstructorDescriptionOpenSSHAgentConnection
(KeyStore keystore, InputStream in, OutputStream out, Closeable closeable) -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
encodeSignature
(com.sshtools.common.ssh.components.SshPublicKey key, int flags, byte[] signature) protected void
onAddKey
(SshAgentAddKey msg) Called when the remote side adds a key the agent.protected void
Called when the remote side requests that all keys be removed from the agent.protected void
Called by the remote side to delete a key from the agentprotected void
onListKeys
(AgentMessage msg) Called by the remote side when a list of the agents keys is requiredprotected void
onLock
(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
Called by the remote side to initiate a private key operation.protected void
onUnlock
(SshAgentUnlock msg) Called by the remote side when the agent is to be unlockedvoid
run()
The connection threadprotected void
Send a failure messageprotected void
Send the agents key list to the remote side.protected void
Send a success message.protected void
sendMessage
(AgentMessage msg) Sends a subsystem message.protected void
sendOperationComplete
(byte[] data) Send the completed signing operation data.
-
Constructor Details
-
OpenSSHAgentConnection
public OpenSSHAgentConnection(KeyStore keystore, InputStream in, OutputStream out, Closeable closeable)
-
-
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
-
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
-
sendMessage
Sends a subsystem message.- Parameters:
msg
- the subsystem message to send- 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
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
-
encodeSignature
protected byte[] encodeSignature(com.sshtools.common.ssh.components.SshPublicKey key, int flags, byte[] signature) throws IOException - Throws:
IOException
-
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
-
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
-