public abstract class SshKeyExchangeClient extends Object implements SshKeyExchange<SshClientContext>
Modifier and Type | Field and Description |
---|---|
protected String |
clientId |
protected byte[] |
clientKexInit |
protected BigInteger |
e |
protected byte[] |
exchangeHash
The exchange hash produced during key exchange.
|
protected BigInteger |
f |
protected boolean |
firstPacketFollows |
protected byte[] |
hostKey
The server's host key.
|
protected SshPublicKey |
key |
protected BigInteger |
secret
The secret value produced during key exchange.
|
protected String |
serverId |
protected byte[] |
serverKexInit |
protected byte[] |
signature
The signature generated over the exchange hash
|
protected TransportProtocol<SshClientContext> |
transport
The transport protocol for sending/receiving messages
|
protected boolean |
useFirstPacket |
Constructor and Description |
---|
SshKeyExchangeClient(String hashAlgorithm)
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
|
String |
getHashAlgorithm() |
byte[] |
getHostKey()
Get the host key supplied during key exchange.
|
BigInteger |
getSecret()
Get the secret value produced during key exchange.
|
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAlgorithm, getProvider, init, test
protected BigInteger secret
protected byte[] exchangeHash
protected byte[] hostKey
protected byte[] signature
protected String clientId
protected String serverId
protected byte[] clientKexInit
protected byte[] serverKexInit
protected SshPublicKey key
protected boolean firstPacketFollows
protected boolean useFirstPacket
protected BigInteger e
protected BigInteger f
protected TransportProtocol<SshClientContext> transport
public SshKeyExchangeClient(String hashAlgorithm)
public void setReceivedNewKeys(boolean receivedNewKeys)
setReceivedNewKeys
in interface SshKeyExchange<SshClientContext>
public void setSentNewKeys(boolean sentNewKeys)
setSentNewKeys
in interface SshKeyExchange<SshClientContext>
public boolean hasSentNewKeys()
hasSentNewKeys
in interface SshKeyExchange<SshClientContext>
public boolean hasReceivedNewKeys()
hasReceivedNewKeys
in interface SshKeyExchange<SshClientContext>
public byte[] getExchangeHash()
getExchangeHash
in interface SshKeyExchange<SshClientContext>
public byte[] getHostKey()
public BigInteger getSecret()
getSecret
in interface SshKeyExchange<SshClientContext>
public byte[] getSignature()
public abstract boolean processMessage(byte[] msg) throws SshException, IOException
processMessage
in interface SshKeyExchange<SshClientContext>
msg
- IOException
SshException
public void reset()
public boolean isComplete()
public String getHashAlgorithm()
getHashAlgorithm
in interface SshKeyExchange<SshClientContext>
protected void calculateExchangeHash() throws 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
IOException
SshException
Copyright © 2017. All rights reserved.