Package com.sshtools.j2ssh.transport
Class TransportProtocolClient
- java.lang.Object
-
- com.sshtools.j2ssh.transport.TransportProtocolCommon
-
- com.sshtools.j2ssh.transport.TransportProtocolClient
-
- All Implemented Interfaces:
TransportProtocol
,java.lang.Runnable
public class TransportProtocolClient extends TransportProtocolCommon
- Version:
- $Revision: 1.49 $
- Author:
- $author$
-
-
Field Summary
Fields Modifier and Type Field Description protected SshPublicKey
pk
-
Fields inherited from class com.sshtools.j2ssh.transport.TransportProtocolCommon
algorithmsIn, algorithmsOut, clientIdent, clientKexInit, completeOnNewKeys, EOL_CRLF, EOL_LF, hostKey, k, kexs, log, messageStore, properties, PROTOCOL_VERSION, serverIdent, serverKexInit, sessionIdentifier, signature, SOFTWARE_VERSION_COMMENTS, sshIn, sshOut, state
-
-
Constructor Summary
Constructors Constructor Description TransportProtocolClient(HostKeyVerification hosts)
Creates a new TransportProtocolClient object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
getDecryptionAlgorithm()
protected java.lang.String
getEncryptionAlgorithm()
protected java.lang.String
getInputStreamCompAlgortihm()
protected java.lang.String
getInputStreamMacAlgorithm()
java.lang.String
getLocalId()
protected SshMsgKexInit
getLocalKexInit()
protected java.lang.String
getOutputStreamCompAlgorithm()
protected java.lang.String
getOutputStreamMacAlgorithm()
java.lang.String
getRemoteId()
protected SshMsgKexInit
getRemoteKexInit()
SshPublicKey
getServerHostKey()
protected void
onDisconnect()
void
onMessageReceived(SshMessage msg)
protected void
onStartTransportProtocol()
protected void
performKeyExchange(SshKeyExchange kex)
void
registerTransportMessages()
void
requestService(Service service)
protected void
setLocalIdent()
protected void
setLocalKexInit(SshMsgKexInit msg)
protected void
setRemoteIdent(java.lang.String ident)
protected void
setRemoteKexInit(SshMsgKexInit msg)
protected void
setupNewKeys(byte[] encryptCSKey, byte[] encryptCSIV, byte[] encryptSCKey, byte[] encryptSCIV, byte[] macCSKey, byte[] macSCKey)
protected boolean
verifyHostKey(byte[] key, byte[] sig, byte[] sigdata)
-
Methods inherited from class com.sshtools.j2ssh.transport.TransportProtocolCommon
addEventHandler, addMessageStore, beginKeyExchange, completeKeyExchange, createLocalKexInit, determineAlgorithm, disconnect, getConnectionId, getEventHandlers, getIncomingByteCount, getKexAlgorithm, getOutgoingByteCount, getProperties, getRemoteEOL, getSessionIdentifier, getState, getUnderlyingProviderDetail, isConnected, onCorruptMac, processMessages, readMessage, removeMessageStore, run, sendDisconnect, sendDisconnect, sendKeyExchangeInit, sendMessage, sendNewKeys, setKexTimeout, setKexTransferLimit, setSendIgnore, startBinaryPacketProtocol, startTransportProtocol, stop, unregisterMessage
-
-
-
-
Field Detail
-
pk
protected SshPublicKey pk
-
-
Constructor Detail
-
TransportProtocolClient
public TransportProtocolClient(HostKeyVerification hosts) throws TransportProtocolException
Creates a new TransportProtocolClient object.- Parameters:
hosts
-- Throws:
TransportProtocolException
-
-
Method Detail
-
onMessageReceived
public void onMessageReceived(SshMessage msg) throws java.io.IOException
- Specified by:
onMessageReceived
in classTransportProtocolCommon
- Parameters:
msg
-- Throws:
java.io.IOException
-
registerTransportMessages
public void registerTransportMessages() throws MessageAlreadyRegisteredException
- Specified by:
registerTransportMessages
in classTransportProtocolCommon
- Throws:
MessageAlreadyRegisteredException
-
requestService
public void requestService(Service service) throws java.io.IOException
- Parameters:
service
-- Throws:
java.io.IOException
SshException
-
onDisconnect
protected void onDisconnect()
- Specified by:
onDisconnect
in classTransportProtocolCommon
-
getDecryptionAlgorithm
protected java.lang.String getDecryptionAlgorithm() throws AlgorithmNotAgreedException
- Specified by:
getDecryptionAlgorithm
in classTransportProtocolCommon
- Returns:
- Throws:
AlgorithmNotAgreedException
-
getEncryptionAlgorithm
protected java.lang.String getEncryptionAlgorithm() throws AlgorithmNotAgreedException
- Specified by:
getEncryptionAlgorithm
in classTransportProtocolCommon
- Returns:
- Throws:
AlgorithmNotAgreedException
-
getInputStreamCompAlgortihm
protected java.lang.String getInputStreamCompAlgortihm() throws AlgorithmNotAgreedException
- Specified by:
getInputStreamCompAlgortihm
in classTransportProtocolCommon
- Returns:
- Throws:
AlgorithmNotAgreedException
-
getInputStreamMacAlgorithm
protected java.lang.String getInputStreamMacAlgorithm() throws AlgorithmNotAgreedException
- Specified by:
getInputStreamMacAlgorithm
in classTransportProtocolCommon
- Returns:
- Throws:
AlgorithmNotAgreedException
-
setLocalIdent
protected void setLocalIdent()
- Specified by:
setLocalIdent
in classTransportProtocolCommon
-
getLocalId
public java.lang.String getLocalId()
- Specified by:
getLocalId
in classTransportProtocolCommon
- Returns:
-
setLocalKexInit
protected void setLocalKexInit(SshMsgKexInit msg)
- Specified by:
setLocalKexInit
in classTransportProtocolCommon
- Parameters:
msg
-
-
getLocalKexInit
protected SshMsgKexInit getLocalKexInit()
- Specified by:
getLocalKexInit
in classTransportProtocolCommon
- Returns:
-
getOutputStreamCompAlgorithm
protected java.lang.String getOutputStreamCompAlgorithm() throws AlgorithmNotAgreedException
- Specified by:
getOutputStreamCompAlgorithm
in classTransportProtocolCommon
- Returns:
- Throws:
AlgorithmNotAgreedException
-
getOutputStreamMacAlgorithm
protected java.lang.String getOutputStreamMacAlgorithm() throws AlgorithmNotAgreedException
- Specified by:
getOutputStreamMacAlgorithm
in classTransportProtocolCommon
- Returns:
- Throws:
AlgorithmNotAgreedException
-
setRemoteIdent
protected void setRemoteIdent(java.lang.String ident)
- Specified by:
setRemoteIdent
in classTransportProtocolCommon
- Parameters:
ident
-
-
getRemoteId
public java.lang.String getRemoteId()
- Specified by:
getRemoteId
in classTransportProtocolCommon
- Returns:
-
setRemoteKexInit
protected void setRemoteKexInit(SshMsgKexInit msg)
- Specified by:
setRemoteKexInit
in classTransportProtocolCommon
- Parameters:
msg
-
-
getRemoteKexInit
protected SshMsgKexInit getRemoteKexInit()
- Specified by:
getRemoteKexInit
in classTransportProtocolCommon
- Returns:
-
getServerHostKey
public SshPublicKey getServerHostKey()
- Returns:
-
onStartTransportProtocol
protected void onStartTransportProtocol() throws java.io.IOException
- Specified by:
onStartTransportProtocol
in classTransportProtocolCommon
- Throws:
java.io.IOException
TransportProtocolException
-
performKeyExchange
protected void performKeyExchange(SshKeyExchange kex) throws java.io.IOException
- Specified by:
performKeyExchange
in classTransportProtocolCommon
- Parameters:
kex
-- Throws:
java.io.IOException
KeyExchangeException
-
setupNewKeys
protected void setupNewKeys(byte[] encryptCSKey, byte[] encryptCSIV, byte[] encryptSCKey, byte[] encryptSCIV, byte[] macCSKey, byte[] macSCKey) throws AlgorithmNotAgreedException, AlgorithmOperationException, AlgorithmNotSupportedException, AlgorithmInitializationException
- Specified by:
setupNewKeys
in classTransportProtocolCommon
- Parameters:
encryptCSKey
-encryptCSIV
-encryptSCKey
-encryptSCIV
-macCSKey
-macSCKey
-- Throws:
AlgorithmNotAgreedException
AlgorithmOperationException
AlgorithmNotSupportedException
AlgorithmInitializationException
-
verifyHostKey
protected boolean verifyHostKey(byte[] key, byte[] sig, byte[] sigdata) throws TransportProtocolException
- Parameters:
key
-sig
-sigdata
-- Returns:
- Throws:
TransportProtocolException
-
-