Package com.sshtools.client.components
Class DiffieHellmanEcdh
java.lang.Object
com.sshtools.client.SshKeyExchangeClient
com.sshtools.client.components.DiffieHellmanEcdh
- All Implemented Interfaces:
com.sshtools.common.ssh.components.Component
,com.sshtools.common.ssh.components.SshComponent
,com.sshtools.common.ssh.SecureComponent
,com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
- Direct Known Subclasses:
DiffieHellmanEcdhNistp256
,DiffieHellmanEcdhNistp384
,DiffieHellmanEcdhNistp521
public abstract class DiffieHellmanEcdh
extends SshKeyExchangeClient
implements com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
Fields inherited from class com.sshtools.client.SshKeyExchangeClient
e, exchangeHash, f, firstPacketFollows, hostKey, key, secret, signature, transport, useFirstPacket
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DiffieHellmanEcdh
(String name, String curve, String hashAlgorithm, com.sshtools.common.ssh.SecurityLevel securityLevel, int priority) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Calculates the exchange hash as an SHA1 hash of the following data.void
init
(com.sshtools.synergy.ssh.SshTransport<SshClientContext> transport, String clientId, String serverId, byte[] clientKexInit, byte[] serverKexInit, com.sshtools.common.ssh.components.SshPrivateKey prvkey, com.sshtools.common.ssh.components.SshPublicKey pubkey, boolean firstPacketFollows, boolean useFirstPacket) boolean
processMessage
(byte[] msg) Process a key exchange messagevoid
test()
Methods inherited from class com.sshtools.client.SshKeyExchangeClient
getExchangeHash, getHashAlgorithm, getHostKey, getPriority, getSecret, getSecurityLevel, getSignature, hasReceivedNewKeys, hasSentNewKeys, isComplete, reset, setReceivedNewKeys, setSentNewKeys
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sshtools.common.ssh.SecureComponent
getPriority, getSecurityLevel
Methods inherited from interface com.sshtools.synergy.ssh.components.SshKeyExchange
getExchangeHash, getHashAlgorithm, getHostKey, getSecret, getSignature, hasReceivedNewKeys, hasSentNewKeys, setReceivedNewKeys, setSentNewKeys
-
Field Details
-
SSH_MSG_KEX_ECDH_INIT
public static final int SSH_MSG_KEX_ECDH_INIT- See Also:
-
SSH_MSG_KEX_ECDH_REPLY
public static final int SSH_MSG_KEX_ECDH_REPLY- See Also:
-
-
Constructor Details
-
DiffieHellmanEcdh
-
-
Method Details
-
getAlgorithm
- Specified by:
getAlgorithm
in interfacecom.sshtools.common.ssh.SecureComponent
- Specified by:
getAlgorithm
in interfacecom.sshtools.common.ssh.components.SshComponent
- Specified by:
getAlgorithm
in interfacecom.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
-
calculateExchangeHash
protected void calculateExchangeHash() throws com.sshtools.common.ssh.SshExceptionDescription copied from class:SshKeyExchangeClient
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
- Overrides:
calculateExchangeHash
in classSshKeyExchangeClient
- Throws:
com.sshtools.common.ssh.SshException
-
init
public void init(com.sshtools.synergy.ssh.SshTransport<SshClientContext> transport, String clientId, String serverId, byte[] clientKexInit, byte[] serverKexInit, com.sshtools.common.ssh.components.SshPrivateKey prvkey, com.sshtools.common.ssh.components.SshPublicKey pubkey, boolean firstPacketFollows, boolean useFirstPacket) throws IOException, com.sshtools.common.ssh.SshException - Specified by:
init
in interfacecom.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
- Throws:
IOException
com.sshtools.common.ssh.SshException
-
processMessage
Description copied from class:SshKeyExchangeClient
Process a key exchange message- Specified by:
processMessage
in interfacecom.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
- Specified by:
processMessage
in classSshKeyExchangeClient
- Returns:
- boolean, indicating whether it has processed the message or not
- Throws:
com.sshtools.common.ssh.SshException
IOException
-
getProvider
- Specified by:
getProvider
in interfacecom.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
-
test
- Specified by:
test
in interfacecom.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
- Throws:
IOException
com.sshtools.common.ssh.SshException
-