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:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,SshAgent,ExecutorServiceCarrier
public abstract class AbstractAgentProxy extends AbstractLoggingBean implements SshAgent, ExecutorServiceCarrier
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringchannelTypeprivate CloseableExecutorServiceexecutor-
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(java.security.KeyPair kp, java.lang.String comment, SshAgentKeyConstraint... constraints)Adds a key to the agent.voidclose()protected BuffercreateBuffer(byte cmd)protected BuffercreateBuffer(byte cmd, int extraLen)java.lang.StringgetChannelType()CloseableExecutorServicegetExecutorService()java.lang.Iterable<? extends java.util.Map.Entry<java.security.PublicKey,java.lang.String>>getIdentities()protected Bufferprepare(Buffer buffer)voidremoveAllIdentities()voidremoveIdentity(java.security.PublicKey key)protected abstract Bufferrequest(Buffer buffer)voidsetChannelType(java.lang.String channelType)java.util.Map.Entry<java.lang.String,byte[]>sign(SessionContext session, java.security.PublicKey key, java.lang.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
-
-
-
-
Field Detail
-
executor
private CloseableExecutorService executor
-
channelType
private java.lang.String channelType
-
-
Constructor Detail
-
AbstractAgentProxy
protected AbstractAgentProxy(CloseableExecutorService executorService)
-
-
Method Detail
-
getChannelType
public java.lang.String getChannelType()
-
setChannelType
public void setChannelType(java.lang.String channelType)
-
getExecutorService
public CloseableExecutorService getExecutorService()
- Specified by:
getExecutorServicein interfaceExecutorServiceCarrier- Returns:
- The
CloseableExecutorServiceto use
-
getIdentities
public java.lang.Iterable<? extends java.util.Map.Entry<java.security.PublicKey,java.lang.String>> getIdentities() throws java.io.IOException- Specified by:
getIdentitiesin interfaceSshAgent- Throws:
java.io.IOException
-
sign
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
- 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:
java.io.IOException- If failed to sign
-
addIdentity
public void addIdentity(java.security.KeyPair kp, java.lang.String comment, SshAgentKeyConstraint... constraints) throws java.io.IOExceptionDescription 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:
java.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 key
-
removeIdentity
public void removeIdentity(java.security.PublicKey key) throws java.io.IOException- Specified by:
removeIdentityin interfaceSshAgent- Throws:
java.io.IOException
-
removeAllIdentities
public void removeAllIdentities() throws java.io.IOException- Specified by:
removeAllIdentitiesin interfaceSshAgent- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.nio.channels.Channel- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
createBuffer
protected Buffer createBuffer(byte cmd)
-
createBuffer
protected Buffer createBuffer(byte cmd, int extraLen)
-
-