Class Rsa2048Sha256

java.lang.Object
com.sshtools.client.SshKeyExchangeClient
com.sshtools.client.components.Rsa2048Sha256
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 Rsa2048Sha256 extends SshKeyExchangeClient implements com.sshtools.synergy.ssh.components.jce.AbstractKeyExchange

Implementation of RFC 4432 https://tools.ietf.org/html/rfc4432

Author:
Lee David Painter
  • Field Details

    • RSA_2048_SHA256

      public static final String RSA_2048_SHA256
      Constant for the algorithm name "rsa2048-sha256".
      See Also:
  • Constructor Details

    • Rsa2048Sha256

      public Rsa2048Sha256()
      Construct an uninitialized instance.
  • Method Details

    • getAlgorithm

      public String getAlgorithm()
      Get the algorithm name for this key exchange
      Specified by:
      getAlgorithm in interface com.sshtools.common.ssh.SecureComponent
      Specified by:
      getAlgorithm in interface com.sshtools.common.ssh.components.SshComponent
      Specified by:
      getAlgorithm in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
      Returns:
      "diffie-hellman-group1-sha1"
    • getProvider

      public String getProvider()
      Specified by:
      getProvider in interface com.sshtools.synergy.ssh.components.jce.AbstractKeyExchange
      Specified by:
      getProvider in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
    • test

      public void test()
      Specified by:
      test in interface com.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 interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
      Throws:
      IOException
      com.sshtools.common.ssh.SshException
    • processMessage

      public boolean processMessage(byte[] tmp) throws com.sshtools.common.ssh.SshException, IOException
      Description copied from class: SshKeyExchangeClient
      Process a key exchange message
      Specified by:
      processMessage in interface com.sshtools.synergy.ssh.components.SshKeyExchange<SshClientContext>
      Specified by:
      processMessage in class SshKeyExchangeClient
      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.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
       

      Overrides:
      calculateExchangeHash in class SshKeyExchangeClient
      Throws:
      IOException
      com.sshtools.common.ssh.SshException