|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sshtools.j2ssh.agent.SshAgentClient
public class SshAgentClient
Provides a client connection to the ssh agent.
Field Summary | |
---|---|
static java.lang.String |
HASH_AND_SIGN
The hash and sign private key operation |
Method Summary | |
---|---|
void |
addKey(SshPrivateKey prvkey,
SshPublicKey pubkey,
java.lang.String description,
KeyConstraints constraints)
Add a key to the agent |
void |
close()
Close the agent |
static java.net.Socket |
connectAgentSocket(java.lang.String location)
Connect a socket to the agent at the location specified. |
static SshAgentClient |
connectLocalAgent(java.lang.String application,
java.lang.String location)
Connect to the local agent. |
void |
deleteAllKeys()
Delete all the keys held by the agent. |
void |
deleteKey(SshPublicKey key,
java.lang.String description)
Delete a key held by the agent |
byte[] |
getRandomData(int count)
Request some random data from the remote side |
byte[] |
hashAndSign(SshPublicKey key,
byte[] data)
Request a hash and sign operation be performed for a given public key. |
java.util.Map |
listKeys()
List all the keys on the agent. |
boolean |
lockAgent(java.lang.String password)
Lock the agent |
void |
ping(byte[] padding)
Ping the remote side with some random padding data |
protected SubsystemMessage |
readMessage()
Read a single message from the inputstream and convert into a valid subsystem message |
protected void |
registerMessages()
Register the subsystem messages |
protected void |
sendForwardingNotice()
Send a forwarding notice. |
protected void |
sendMessage(SubsystemMessage msg)
Send a subsystem message |
protected void |
sendVersionRequest(java.lang.String application)
Request the agent version. |
boolean |
unlockAgent(java.lang.String password)
Unlock the agent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String HASH_AND_SIGN
Method Detail |
---|
public static SshAgentClient connectLocalAgent(java.lang.String application, java.lang.String location) throws AgentNotAvailableException, java.io.IOException
application
- the application connectinglocation
- the location of the agent, in the form "localhost:port"
AgentNotAvailableException
- if the agent is not available at the
location specified
java.io.IOException
- if an IO error occurspublic static java.net.Socket connectAgentSocket(java.lang.String location) throws AgentNotAvailableException, java.io.IOException
location
- the location of the agent, in the form "localhost:port"
AgentNotAvailableException
- if an agent is not available at the
location specified
java.io.IOException
- if an IO error occurspublic void close()
protected void registerMessages()
protected void sendVersionRequest(java.lang.String application) throws java.io.IOException
application
- the application connecting
java.io.IOException
- if an IO error occurspublic void addKey(SshPrivateKey prvkey, SshPublicKey pubkey, java.lang.String description, KeyConstraints constraints) throws java.io.IOException
prvkey
- the private key to addpubkey
- the private keys public keydescription
- a description of the keyconstraints
- a set of contraints for key use
java.io.IOException
- if an IO error occurspublic byte[] hashAndSign(SshPublicKey key, byte[] data) throws java.io.IOException
key
- the public key of the required private keydata
- the data to has and sign
java.io.IOException
- if an IO error occurspublic java.util.Map listKeys() throws java.io.IOException
java.io.IOException
- if an IO error occurspublic boolean lockAgent(java.lang.String password) throws java.io.IOException
password
- password that will be required to unlock
java.io.IOException
- if an IO error occurspublic boolean unlockAgent(java.lang.String password) throws java.io.IOException
password
- the password to unlock
java.io.IOException
- if an IO error occurspublic byte[] getRandomData(int count) throws java.io.IOException
count
- the number of bytes needed
java.io.IOException
- if an IO error occurspublic void ping(byte[] padding) throws java.io.IOException
padding
- the padding data
java.io.IOException
- if an IO error occurspublic void deleteKey(SshPublicKey key, java.lang.String description) throws java.io.IOException
key
- the public key of the private key to deletedescription
- the description of the key
java.io.IOException
- if an IO error occurspublic void deleteAllKeys() throws java.io.IOException
java.io.IOException
- if an IO error occursprotected void sendForwardingNotice() throws java.io.IOException
java.io.IOException
- if an IO error occursprotected void sendMessage(SubsystemMessage msg) throws java.io.IOException
msg
- the message to send
java.io.IOException
- if an IO error occursprotected SubsystemMessage readMessage() throws InvalidMessageException
InvalidMessageException
- if the message received is invalid
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |