Class SshAgentClient
- java.lang.Object
-
- org.eclipse.jgit.internal.transport.sshd.agent.SshAgentClient
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Channel
,org.apache.sshd.agent.SshAgent
public class SshAgentClient extends Object implements org.apache.sshd.agent.SshAgent
A client for an SSH2 agent. This client supports querying identities, signature requests, and adding keys to an agent (with or without constraints). Removing keys is not supported, and the older SSH1 protocol is not supported.- See Also:
- SSH Agent Protocol, RFC draft
-
-
Constructor Summary
Constructors Constructor Description SshAgentClient(Connector connector)
Creates a newSshAgentClient
implementing the SSH2 ssh agent protocol, using the givenConnector
to connect to the SSH agent and to exchange messages.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIdentity(KeyPair key, String comment, org.apache.sshd.agent.SshAgentKeyConstraint... constraints)
void
close()
Iterable<? extends Map.Entry<PublicKey,String>>
getIdentities()
boolean
isOpen()
void
removeAllIdentities()
void
removeIdentity(PublicKey key)
Map.Entry<String,byte[]>
sign(org.apache.sshd.common.session.SessionContext session, PublicKey key, String algorithm, byte[] data)
-
-
-
Constructor Detail
-
SshAgentClient
public SshAgentClient(Connector connector)
Creates a newSshAgentClient
implementing the SSH2 ssh agent protocol, using the givenConnector
to connect to the SSH agent and to exchange messages.- Parameters:
connector
-Connector
to use
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getIdentities
public Iterable<? extends Map.Entry<PublicKey,String>> getIdentities() throws IOException
- Specified by:
getIdentities
in interfaceorg.apache.sshd.agent.SshAgent
- Throws:
IOException
-
sign
public Map.Entry<String,byte[]> sign(org.apache.sshd.common.session.SessionContext session, PublicKey key, String algorithm, byte[] data) throws IOException
- Specified by:
sign
in interfaceorg.apache.sshd.agent.SshAgent
- Throws:
IOException
-
addIdentity
public void addIdentity(KeyPair key, String comment, org.apache.sshd.agent.SshAgentKeyConstraint... constraints) throws IOException
- Specified by:
addIdentity
in interfaceorg.apache.sshd.agent.SshAgent
- Throws:
IOException
-
removeIdentity
public void removeIdentity(PublicKey key) throws IOException
- Specified by:
removeIdentity
in interfaceorg.apache.sshd.agent.SshAgent
- Throws:
IOException
-
removeAllIdentities
public void removeAllIdentities() throws IOException
- Specified by:
removeAllIdentities
in interfaceorg.apache.sshd.agent.SshAgent
- Throws:
IOException
-
-