Package com.sshtools.client.components
Class Rsa1024Sha1
java.lang.Object
com.sshtools.client.SshKeyExchangeClient
com.sshtools.client.components.Rsa1024Sha1
- 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.jce.AbstractKeyExchange
,com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
public class Rsa1024Sha1
extends SshKeyExchangeClient
implements com.sshtools.synergy.ssh.components.jce.AbstractKeyExchange
Implementation of RFC 4432 https://tools.ietf.org/html/rfc4432
- Author:
- Lee David Painter
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Constant for the algorithm name "rsa1024-sha1".Fields inherited from class com.sshtools.client.SshKeyExchangeClient
e, exchangeHash, f, firstPacketFollows, hostKey, key, secret, signature, transport, useFirstPacket
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Calculates the exchange hash as an SHA1 hash of the following data.Get the algorithm name for this key exchangevoid
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
isKeyExchangeMessage
(int messageid) boolean
processMessage
(byte[] tmp) 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
-
Field Details
-
RSA_1024_SHA1
Constant for the algorithm name "rsa1024-sha1".- See Also:
-
-
Constructor Details
-
Rsa1024Sha1
public Rsa1024Sha1()Construct an uninitialized instance.
-
-
Method Details
-
getAlgorithm
Get the algorithm name for this key exchange- 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>
- Returns:
- "diffie-hellman-group1-sha1"
-
getProvider
- Specified by:
getProvider
in interfacecom.sshtools.synergy.ssh.components.jce.AbstractKeyExchange
- Specified by:
getProvider
in interfacecom.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
-
test
public void test()- Specified by:
test
in interfacecom.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
-
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
-
calculateExchangeHash
protected void calculateExchangeHash() throws com.sshtools.common.ssh.SshExceptionCalculates 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:
IOException
com.sshtools.common.ssh.SshException
-
isKeyExchangeMessage
public boolean isKeyExchangeMessage(int messageid)
-