Modifier and Type | Field and Description |
---|---|
private SshAgent |
agent |
SSH_AUTHSOCKET_ENV_NAME
Constructor and Description |
---|
AgentDelegate(SshAgent agent) |
Modifier and Type | Method and Description |
---|---|
void |
addIdentity(java.security.KeyPair key,
java.lang.String comment,
SshAgentKeyConstraint... constraints)
Adds a key to the agent.
|
void |
close() |
java.lang.Iterable<? extends java.util.Map.Entry<java.security.PublicKey,java.lang.String>> |
getIdentities() |
boolean |
isOpen() |
void |
removeAllIdentities() |
void |
removeIdentity(java.security.PublicKey key) |
java.util.Map.Entry<java.lang.String,byte[]> |
sign(SessionContext session,
java.security.PublicKey key,
java.lang.String algo,
byte[] data) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
resolveLocalIdentity
private final SshAgent agent
public AgentDelegate(SshAgent agent)
public boolean isOpen()
isOpen
in interface java.nio.channels.Channel
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface java.nio.channels.Channel
java.io.IOException
public java.lang.Iterable<? extends java.util.Map.Entry<java.security.PublicKey,java.lang.String>> getIdentities() throws java.io.IOException
getIdentities
in interface SshAgent
java.io.IOException
public java.util.Map.Entry<java.lang.String,byte[]> sign(SessionContext session, java.security.PublicKey key, java.lang.String algo, byte[] data) throws java.io.IOException
sign
in interface SshAgent
session
- The current SessionContext
key
- The PublicKey
to use for signingalgo
- Recommended signature algorithm - if null
/empty then one will be selected based on
the key type and/or signature factories. Note: even if specific algorithm specified,
the implementation may disregard and choose anotherdata
- Data to signjava.io.IOException
- If failed to signpublic void addIdentity(java.security.KeyPair key, java.lang.String comment, SshAgentKeyConstraint... constraints) throws java.io.IOException
SshAgent
addIdentity
in interface SshAgent
key
- KeyPair
to addcomment
- to associate with the keyconstraints
- SshAgentKeyConstraint
s for this key to pass on to the agentjava.io.IOException
- if an error in the communication with the agent occurred, or the agent did not return a reply
indicating successful addition of the keypublic void removeIdentity(java.security.PublicKey key) throws java.io.IOException
removeIdentity
in interface SshAgent
java.io.IOException
public void removeAllIdentities() throws java.io.IOException
removeAllIdentities
in interface SshAgent
java.io.IOException