public abstract class SshKeyExchangeClient extends java.lang.Object implements com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
clientId |
protected byte[] |
clientKexInit |
protected java.math.BigInteger |
e |
protected byte[] |
exchangeHash
The exchange hash produced during key exchange.
|
protected java.math.BigInteger |
f |
protected boolean |
firstPacketFollows |
protected byte[] |
hostKey
The server's host key.
|
protected com.sshtools.common.ssh.components.SshPublicKey |
key |
protected java.math.BigInteger |
secret
The secret value produced during key exchange.
|
protected java.lang.String |
serverId |
protected byte[] |
serverKexInit |
protected byte[] |
signature
The signature generated over the exchange hash
|
protected com.sshtools.synergy.ssh.SshTransport<SshClientContext> |
transport
The transport protocol for sending/receiving messages
|
protected boolean |
useFirstPacket |
Constructor and Description |
---|
SshKeyExchangeClient(java.lang.String hashAlgorithm,
com.sshtools.common.ssh.SecurityLevel securityLevel,
int priority)
Contruct an uninitialized key exchange
|
Modifier and Type | Method and Description |
---|---|
protected void |
calculateExchangeHash()
Calculates the exchange hash as an SHA1 hash of the following data.
|
byte[] |
getExchangeHash()
Get the output of the key exchange
|
java.lang.String |
getHashAlgorithm() |
byte[] |
getHostKey()
Get the host key supplied during key exchange.
|
int |
getPriority() |
java.math.BigInteger |
getSecret()
Get the secret value produced during key exchange.
|
com.sshtools.common.ssh.SecurityLevel |
getSecurityLevel() |
byte[] |
getSignature()
Get the signature produced during key exchange.
|
boolean |
hasReceivedNewKeys() |
boolean |
hasSentNewKeys() |
boolean |
isComplete() |
abstract boolean |
processMessage(byte[] msg)
Process a key exchange message
|
void |
reset()
Reset the key exchange.
|
void |
setReceivedNewKeys(boolean receivedNewKeys) |
void |
setSentNewKeys(boolean sentNewKeys) |
protected java.math.BigInteger secret
protected byte[] exchangeHash
protected byte[] hostKey
protected byte[] signature
protected java.lang.String clientId
protected java.lang.String serverId
protected byte[] clientKexInit
protected byte[] serverKexInit
protected com.sshtools.common.ssh.components.SshPublicKey key
protected boolean firstPacketFollows
protected boolean useFirstPacket
protected java.math.BigInteger e
protected java.math.BigInteger f
protected com.sshtools.synergy.ssh.SshTransport<SshClientContext> transport
public SshKeyExchangeClient(java.lang.String hashAlgorithm, com.sshtools.common.ssh.SecurityLevel securityLevel, int priority)
public com.sshtools.common.ssh.SecurityLevel getSecurityLevel()
getSecurityLevel
in interface com.sshtools.common.ssh.SecureComponent
public int getPriority()
getPriority
in interface com.sshtools.common.ssh.SecureComponent
public void setReceivedNewKeys(boolean receivedNewKeys)
setReceivedNewKeys
in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
public void setSentNewKeys(boolean sentNewKeys)
setSentNewKeys
in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
public boolean hasSentNewKeys()
hasSentNewKeys
in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
public boolean hasReceivedNewKeys()
hasReceivedNewKeys
in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
public byte[] getExchangeHash()
getExchangeHash
in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
public byte[] getHostKey()
getHostKey
in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
public java.math.BigInteger getSecret()
getSecret
in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
public byte[] getSignature()
getSignature
in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
public abstract boolean processMessage(byte[] msg) throws com.sshtools.common.ssh.SshException, java.io.IOException
processMessage
in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
msg
- java.io.IOException
com.sshtools.common.ssh.SshException
public void reset()
public boolean isComplete()
public java.lang.String getHashAlgorithm()
getHashAlgorithm
in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
protected void calculateExchangeHash() throws com.sshtools.common.ssh.SshException
Calculates the exchange hash as an SHA1 hash of the following data.
String the client's version string (CR and NL excluded) String the server's version string (CR and NL excluded) String the payload of the client's SSH_MSG_KEXINIT String the payload of the server's SSH_MSG_KEXINIT String the host key BigInteger e, exchange value sent by the client BigInteger f, exchange value sent by the server BigInteger K, the shared secret
java.io.IOException
com.sshtools.common.ssh.SshException
Copyright © 2022. All rights reserved.