| Modifier and Type | Field and Description |
|---|---|
private java.util.List<java.util.Map.Entry<java.security.KeyPair,java.lang.String>> |
keys |
private static org.slf4j.Logger |
LOG |
private java.util.concurrent.atomic.AtomicBoolean |
open |
SSH_AUTHSOCKET_ENV_NAME| Constructor and Description |
|---|
AgentImpl() |
| 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() |
protected static java.util.Map.Entry<java.security.KeyPair,java.lang.String> |
getKeyPair(java.util.Collection<? extends java.util.Map.Entry<java.security.KeyPair,java.lang.String>> keys,
java.security.PublicKey key) |
boolean |
isOpen() |
void |
removeAllIdentities() |
void |
removeIdentity(java.security.PublicKey key) |
java.security.KeyPair |
resolveLocalIdentity(java.security.PublicKey key)
Used for reporting client-side public key authentication via agent
|
java.util.Map.Entry<java.lang.String,byte[]> |
sign(SessionContext session,
java.security.PublicKey key,
java.lang.String algo,
byte[] data) |
private static final org.slf4j.Logger LOG
private final java.util.List<java.util.Map.Entry<java.security.KeyPair,java.lang.String>> keys
private final java.util.concurrent.atomic.AtomicBoolean open
public boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic java.lang.Iterable<? extends java.util.Map.Entry<java.security.PublicKey,java.lang.String>> getIdentities()
throws java.io.IOException
getIdentities in interface SshAgentjava.io.IOExceptionpublic 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 SshAgentsession - The current SessionContextkey - 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
SshAgentaddIdentity in interface SshAgentkey - KeyPair to addcomment - to associate with the keyconstraints - SshAgentKeyConstraints 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 java.security.KeyPair resolveLocalIdentity(java.security.PublicKey key)
SshAgentresolveLocalIdentity in interface SshAgentkey - The PublicKey that is going to be usedKeyPair identity for it - if available - null otherwisepublic void removeIdentity(java.security.PublicKey key)
throws java.io.IOException
removeIdentity in interface SshAgentjava.io.IOExceptionpublic void removeAllIdentities()
throws java.io.IOException
removeAllIdentities in interface SshAgentjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channeljava.io.IOExceptionprotected static java.util.Map.Entry<java.security.KeyPair,java.lang.String> getKeyPair(java.util.Collection<? extends java.util.Map.Entry<java.security.KeyPair,java.lang.String>> keys,
java.security.PublicKey key)