Top Description Fields Methods
org.apache.sshd.agent

public Interface SshAgent

extends Channel
Known Direct Implementers
org.apache.sshd.agent.common.AbstractAgentProxy, org.apache.sshd.agent.common.AgentDelegate, org.apache.sshd.agent.local.AgentImpl
Imports
java.io.IOException, java.security.KeyPair, .PublicKey, java.util.Map, org.apache.sshd.common.session.SessionContext

SSH key agent server

Field Summary

Modifier and TypeField and Description
public static final String

Method Summary

Modifier and TypeMethod and Description
public void
addIdentity(KeyPair
KeyPair to add
key
,
String
to associate with the key
comment
,
SshAgentKeyConstraint...
SshAgentKeyConstraints for this key to pass on to the agent
constraints
)

Adds a key to the agent.

public Iterable<? extends Map.Entry<PublicKey, String>>
public void
public void
public default KeyPair

Returns:

The KeyPair identity for it - if available - null otherwise
resolveLocalIdentity
(PublicKey
The PublicKey that is going to be used
key
)

Used for reporting client-side public key authentication via agent

public Map.Entry<String, byte[]>

Returns:

used algorithm + signed data - using the identity
sign
(SessionContext
The current SessionContext
session
,
PublicKey
The PublicKey to use for signing
key
,
String
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 another

algo
,
byte[]
Data to sign
data
)

Inherited from java.nio.channels.Channel:
closeisOpen

Field Detail

SSH_AUTHSOCKET_ENV_NAMEback to summary
public static final String SSH_AUTHSOCKET_ENV_NAME

Method Detail

addIdentityback to summary
public void addIdentity(KeyPair key, String comment, SshAgentKeyConstraint... constraints) throws IOException

Adds a key to the agent.

Parameters
key:KeyPair

KeyPair to add

comment:String

to associate with the key

constraints:SshAgentKeyConstraint[]

SshAgentKeyConstraints for this key to pass on to the agent

Exceptions
IOException:
if an error in the communication with the agent occurred, or the agent did not return a reply indicating successful addition of the key
getIdentitiesback to summary
public Iterable<? extends Map.Entry<PublicKey, String>> getIdentities() throws IOException
removeAllIdentitiesback to summary
public void removeAllIdentities() throws IOException
removeIdentityback to summary
public void removeIdentity(PublicKey key) throws IOException
resolveLocalIdentityback to summary
public default KeyPair resolveLocalIdentity(PublicKey key)

Used for reporting client-side public key authentication via agent

Parameters
key:PublicKey

The PublicKey that is going to be used

Returns:KeyPair

The KeyPair identity for it - if available - null otherwise

signback to summary
public Map.Entry<String, byte[]> sign(SessionContext session, PublicKey key, String algo, byte[] data) throws IOException
Parameters
session:SessionContext

The current SessionContext

key:PublicKey

The PublicKey to use for signing

algo:String

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 another

data:byte[]

Data to sign

Returns:Map.Entry<String, byte[]>

used algorithm + signed data - using the identity

Exceptions
IOException:
If failed to sign