Package org.apache.sshd.agent.common
Class AbstractAgentProxy
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.agent.common.AbstractAgentProxy
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,SshAgent,ExecutorServiceCarrier
- Direct Known Subclasses:
AgentClient
public abstract class AbstractAgentProxy extends AbstractLoggingBean implements SshAgent, ExecutorServiceCarrier
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.agent.SshAgent
SSH_AUTHSOCKET_ENV_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAgentProxy(CloseableExecutorService executorService)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddIdentity(KeyPair kp, String comment, SshAgentKeyConstraint... constraints)Adds a key to the agent.voidclose()protected BuffercreateBuffer(byte cmd)protected BuffercreateBuffer(byte cmd, int extraLen)StringgetChannelType()CloseableExecutorServicegetExecutorService()Iterable<? extends Map.Entry<PublicKey,String>>getIdentities()protected Bufferprepare(Buffer buffer)voidremoveAllIdentities()voidremoveIdentity(PublicKey key)protected abstract Bufferrequest(Buffer buffer)voidsetChannelType(String channelType)Map.Entry<String,byte[]>sign(SessionContext session, PublicKey key, String algo, byte[] data)-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.agent.SshAgent
resolveLocalIdentity
-
-
-
-
Constructor Detail
-
AbstractAgentProxy
protected AbstractAgentProxy(CloseableExecutorService executorService)
-
-
Method Detail
-
getChannelType
public String getChannelType()
-
setChannelType
public void setChannelType(String channelType)
-
getExecutorService
public CloseableExecutorService getExecutorService()
- Specified by:
getExecutorServicein interfaceExecutorServiceCarrier
-
getIdentities
public Iterable<? extends Map.Entry<PublicKey,String>> getIdentities() throws IOException
- Specified by:
getIdentitiesin interfaceSshAgent- Throws:
IOException
-
sign
public Map.Entry<String,byte[]> sign(SessionContext session, PublicKey key, String algo, byte[] data) throws IOException
- Specified by:
signin interfaceSshAgent- Parameters:
session- The currentSessionContextkey- ThePublicKeyto use for signingalgo- Recommended signature algorithm - ifnull/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 sign- Returns:
- used algorithm + signed data - using the identity
- Throws:
IOException- If failed to sign
-
addIdentity
public void addIdentity(KeyPair kp, String comment, SshAgentKeyConstraint... constraints) throws IOException
Description copied from interface:SshAgentAdds a key to the agent.- Specified by:
addIdentityin interfaceSshAgent- Parameters:
kp-KeyPairto addcomment- to associate with the keyconstraints-SshAgentKeyConstraints for this key to pass on to the agent- Throws:
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
-
removeIdentity
public void removeIdentity(PublicKey key) throws IOException
- Specified by:
removeIdentityin interfaceSshAgent- Throws:
IOException
-
removeAllIdentities
public void removeAllIdentities() throws IOException- Specified by:
removeAllIdentitiesin interfaceSshAgent- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
createBuffer
protected Buffer createBuffer(byte cmd)
-
createBuffer
protected Buffer createBuffer(byte cmd, int extraLen)
-
request
protected abstract Buffer request(Buffer buffer) throws IOException
- Throws:
IOException
-
-