Package com.trilead.ssh2.packets

Examples of com.trilead.ssh2.packets.PacketKexDhGexReply


        return;
      }

      if (kxs.state == 2)
      {
        PacketKexDhGexReply dhgexrpl = new PacketKexDhGexReply(msg, 0, msglen);

        kxs.hostkey = dhgexrpl.getHostKey();

        if (verifier != null)
        {
          boolean vres = false;

          try
          {
            vres = verifier.verifyServerHostKey(hostname, port, kxs.np.server_host_key_algo, kxs.hostkey);
          }
          catch (Exception e)
          {
            throw (IOException) new IOException(
                "The server hostkey was not accepted by the verifier callback.").initCause(e);
          }

          if (vres == false)
            throw new IOException("The server hostkey was not accepted by the verifier callback");
        }

        kxs.dhgx.setF(dhgexrpl.getF());

        try
        {
          kxs.H = kxs.dhgx.calculateH(csh.getClientString(), csh.getServerString(),
              kxs.localKEX.getPayload(), kxs.remoteKEX.getPayload(), dhgexrpl.getHostKey(),
              kxs.dhgexParameters);
        }
        catch (IllegalArgumentException e)
        {
          throw (IOException) new IOException("KEX error.").initCause(e);
        }

        boolean res = verifySignature(dhgexrpl.getSignature(), kxs.hostkey);

        if (res == false)
          throw new IOException("Hostkey signature sent by remote is wrong!");

        kxs.K = kxs.dhgx.getK();
View Full Code Here


        return;
      }

      if (kxs.state == 2)
      {
        PacketKexDhGexReply dhgexrpl = new PacketKexDhGexReply(msg, 0, msglen);

        kxs.hostkey = dhgexrpl.getHostKey();

        if (verifier != null)
        {
          boolean vres = false;

          try
          {
            vres = verifier.verifyServerHostKey(hostname, port, kxs.np.server_host_key_algo, kxs.hostkey);
          }
          catch (Exception e)
          {
            throw (IOException) new IOException(
                "The server hostkey was not accepted by the verifier callback.").initCause(e);
          }

          if (vres == false)
            throw new IOException("The server hostkey was not accepted by the verifier callback");
        }
       
        kxs.dhgx.setF(dhgexrpl.getF());
       
        try
        {
          kxs.H = kxs.dhgx.calculateH(csh.getClientString(), csh.getServerString(),
              kxs.localKEX.getPayload(), kxs.remoteKEX.getPayload(), dhgexrpl.getHostKey(),
              kxs.dhgexParameters);
        }
        catch (IllegalArgumentException e)
        {
          throw (IOException) new IOException("KEX error.").initCause(e);
        }

        boolean res = verifySignature(dhgexrpl.getSignature(), kxs.hostkey);

        if (res == false)
          throw new IOException("Hostkey signature sent by remote is wrong!");

        kxs.K = kxs.dhgx.getK();
View Full Code Here

        return;
      }

      if (kxs.state == 2)
      {
        PacketKexDhGexReply dhgexrpl = new PacketKexDhGexReply(msg, 0, msglen);

        kxs.hostkey = dhgexrpl.getHostKey();

        if (verifier != null)
        {
          boolean vres = false;

          try
          {
            vres = verifier.verifyServerHostKey(hostname, port, kxs.np.server_host_key_algo, kxs.hostkey);
          }
          catch (Exception e)
          {
            throw (IOException) new IOException(
                "The server hostkey was not accepted by the verifier callback.").initCause(e);
          }

          if (vres == false)
            throw new IOException("The server hostkey was not accepted by the verifier callback");
        }

        kxs.dhgx.setF(dhgexrpl.getF());

        try
        {
          kxs.H = kxs.dhgx.calculateH(csh.getClientString(), csh.getServerString(),
              kxs.localKEX.getPayload(), kxs.remoteKEX.getPayload(), dhgexrpl.getHostKey(),
              kxs.dhgexParameters);
        }
        catch (IllegalArgumentException e)
        {
          throw (IOException) new IOException("KEX error.").initCause(e);
        }

        boolean res = verifySignature(dhgexrpl.getSignature(), kxs.hostkey);

        if (res == false)
          throw new IOException("Hostkey signature sent by remote is wrong!");

        kxs.K = kxs.dhgx.getK();
View Full Code Here

        return;
      }

      if (kxs.state == 2)
      {
        PacketKexDhGexReply dhgexrpl = new PacketKexDhGexReply(msg, 0, msglen);

        kxs.remote_hostkey = dhgexrpl.getHostKey();

        if (verifier != null)
        {
          boolean vres = false;

          try
          {
            vres = verifier.verifyServerHostKey(hostname, port, kxs.np.server_host_key_algo, kxs.remote_hostkey);
          }
          catch (Exception e)
          {
            throw new IOException(
                "The server hostkey was not accepted by the verifier callback.", e);
          }

          if (vres == false)
            throw new IOException("The server hostkey was not accepted by the verifier callback");
        }

        kxs.dhgx.setF(dhgexrpl.getF());

        try
        {
          kxs.H = kxs.dhgx.calculateH(csh.getClientString(), csh.getServerString(),
              kxs.localKEX.getPayload(), kxs.remoteKEX.getPayload(), dhgexrpl.getHostKey(),
              kxs.dhgexParameters);
        }
        catch (IllegalArgumentException e)
        {
          throw new IOException("KEX error.", e);
        }

        boolean res = verifySignature(dhgexrpl.getSignature(), kxs.remote_hostkey);

        if (res == false)
          throw new IOException("Hostkey signature sent by remote is wrong!");

        kxs.K = kxs.dhgx.getK();
View Full Code Here

        return;
      }

      if (kxs.state == 2)
      {
        PacketKexDhGexReply dhgexrpl = new PacketKexDhGexReply(msg, 0, msglen);

        kxs.remote_hostkey = dhgexrpl.getHostKey();

        if (verifier != null)
        {
          boolean vres = false;

          try
          {
            vres = verifier.verifyServerHostKey(hostname, port, kxs.np.server_host_key_algo, kxs.remote_hostkey);
          }
          catch (Exception e)
          {
            throw (IOException) new IOException(
                "The server hostkey was not accepted by the verifier callback.").initCause(e);
          }

          if (vres == false)
            throw new IOException("The server hostkey was not accepted by the verifier callback");
        }

        kxs.dhgx.setF(dhgexrpl.getF());

        try
        {
          kxs.H = kxs.dhgx.calculateH(csh.getClientString(), csh.getServerString(),
              kxs.localKEX.getPayload(), kxs.remoteKEX.getPayload(), dhgexrpl.getHostKey(),
              kxs.dhgexParameters);
        }
        catch (IllegalArgumentException e)
        {
          throw (IOException) new IOException("KEX error.").initCause(e);
        }

        boolean res = verifySignature(dhgexrpl.getSignature(), kxs.remote_hostkey);

        if (res == false)
          throw new IOException("Hostkey signature sent by remote is wrong!");

        kxs.K = kxs.dhgx.getK();
View Full Code Here

   */
  protected Connection getBaseAuthentication() throws Exception {

    try { // to connect and authenticate
      boolean isAuthenticated = false;
      this.setSshConnection(new Connection(this.host, this.port));

      if (proxyHost != null && this.proxyHost.length() > 0) {
        if (this.proxyUser != null && this.proxyUser.length() > 0) {
          this.getSshConnection().setProxyData(new HTTPProxyData(this.proxyHost, this.proxyPort));
        }
View Full Code Here

    @SuppressWarnings("unused")
    final String conMethodName = conClassName + "::Connect";

    try {
      isConnected = false;
      this.setSshConnection(new Connection(pstrHostName, pintPortNumber));

    }
    catch (Exception e) {
      if (this.getSshConnection() != null)
        try {
View Full Code Here

    try {
      isConnected = false;
      String strHostName = objCO.getHost().Value();
      int intPortNo = objCO.getPort().value();
      this.setSshConnection(new Connection(strHostName, intPortNo));

      if (objCO.getProxy_host().IsNotEmpty()) {
        HTTPProxyData objProxy = null;
        if (objCO.getProxy_user().IsEmpty()) {
          objProxy = new HTTPProxyData(objCO.getProxy_host().Value(), objCO.getProxy_port().value());
View Full Code Here

     */
    public Connection getBaseAuthentication() throws Exception {
       
        try { // to connect and authenticate
            boolean isAuthenticated = false;
            this.setSshConnection(new Connection(this.getHost(), this.getPort()));
               
            if (this.getProxyHost() != null && this.getProxyHost().length() > 0) {
                if (this.getProxyUser() != null && this.getProxyUser().length() > 0) {
                    this.getSshConnection().setProxyData(new HTTPProxyData(this.getProxyHost(), this.getProxyPort()));
                } else {
View Full Code Here

    }
   
    public void connect() throws Exception{
      try { // to connect and authenticate
            boolean isAuthenticated = false;
            sshConnection = new Connection(this.getHost(), this.getPort());
               
            if (this.getProxyHost() != null && this.getProxyHost().length() > 0) {
                if (this.getProxyUser() != null && this.getProxyUser().length() > 0) {                   
                    sshConnection.setProxyData(new HTTPProxyData(this.getProxyHost(), this.getProxyPort(), this.getProxyUser(), this.getProxyPassword()));
                } else {
View Full Code Here

TOP

Related Classes of com.trilead.ssh2.packets.PacketKexDhGexReply

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.