public abstract class SshKeyExchangeClient extends java.lang.Object implements 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 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 SshTransport<SshClientContext> |
transport
The transport protocol for sending/receiving messages
|
protected boolean |
useFirstPacket |
| Constructor and Description |
|---|
SshKeyExchangeClient(java.lang.String hashAlgorithm,
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.
|
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAlgorithm, getProvider, init, testprotected 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 SshPublicKey key
protected boolean firstPacketFollows
protected boolean useFirstPacket
protected java.math.BigInteger e
protected java.math.BigInteger f
protected SshTransport<SshClientContext> transport
public SshKeyExchangeClient(java.lang.String hashAlgorithm,
SecurityLevel securityLevel,
int priority)
public SecurityLevel getSecurityLevel()
getSecurityLevel in interface SecureComponentpublic int getPriority()
getPriority in interface SecureComponentpublic 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()
getHostKey in interface SshKeyExchange<SshClientContext>public java.math.BigInteger getSecret()
getSecret in interface SshKeyExchange<SshClientContext>public byte[] getSignature()
getSignature in interface SshKeyExchange<SshClientContext>public abstract boolean processMessage(byte[] msg)
throws SshException,
java.io.IOException
processMessage in interface SshKeyExchange<SshClientContext>msg - java.io.IOExceptionSshExceptionpublic void reset()
public boolean isComplete()
public java.lang.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
java.io.IOExceptionSshExceptionCopyright © 2022. All rights reserved.