Package ch.ethz.ssh2.crypto

Examples of ch.ethz.ssh2.crypto.Base64


    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        Utils.deleteRecursive(f);
        f.mkdirs();
        assertTrue(f.exists());

        String name = "test.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        name = "test2.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        assertTrue(f.delete());
        conn.close();
    }
View Full Code Here


    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        Utils.deleteRecursive(f);
        f.mkdirs();
        assertTrue(f.exists());

        String name = "test.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        name = "test2.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        assertTrue(f.delete());
        conn.close();
    }
View Full Code Here

    /** {@inheritDoc} */
    public void open()
        throws AuthenticationException, CommandAbortedException
    {
        connection = new Connection( host, port );

        /* TODO: add proxy support
        ProxyData proxy = new HTTPProxyData( proxyHost, proxyPort, proxyUserName, proxyPassword );

        connection.setProxyData( proxy );
View Full Code Here

    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        scp_client.put(toBytes(props, ""), "test.properties", "target/scp/gan");
        assertTrue(f.exists());
        scp_client.put(toBytes(props, ""), "test2.properties", "target/scp/gan");
        assertTrue(f.exists());
        f.delete();
        conn.close();
    }
View Full Code Here

        throw new IOException("Fatal error during MAC startup!");
      }

      tm.changeRecvCipher(cbc, mac);

      ConnectionInfo sci = new ConnectionInfo();

      kexCount++;

      sci.keyExchangeAlgorithm = kxs.np.kex_algo;
      sci.keyExchangeCounter = kexCount;
View Full Code Here

      ServerHostKeyVerifier keyVerifier, SecureRandom rnd)
  {
    this.tm = tm;
    this.csh = csh;
    this.nextKEXcryptoWishList = initialCwl;
    this.nextKEXdhgexParameters = new DHGexParameters();
    this.hostname = hostname;
    this.port = port;
    this.verifier = keyVerifier;
    this.rnd = rnd;
  }
View Full Code Here

      Connection conn = new Connection(hostname);

      /* We want to connect through a HTTP proxy */
     
      conn.setProxyData(new HTTPProxyData(proxyHost, proxyPort));
     
      // if the proxy requires basic authentication:
      // conn.setProxyData(new HTTPProxyData(proxyHost, proxyPort, "username", "secret"));
     
      /* Now connect (through the proxy) */
 
View Full Code Here

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

      if (objCO.getProxy_host().IsNotEmpty()) {
        HTTPProxyData objProxy = null;
        if (objCO.getProxy_user().IsEmpty()) {
          objProxy = new HTTPProxyData(objCO.getProxy_host().Value(), objCO.getProxy_port().value());
        }
        else {
          objProxy = new HTTPProxyData(objCO.getProxy_host().Value(), objCO.getProxy_port().value(), objCO.getProxy_user().Value(),
              objCO.getProxy_password().Value());
        }
        this.getSshConnection().setProxyData(objProxy);
      }
      this.getSshConnection().connect();
View Full Code Here

       * (the above text is based partially on the OpenSSH man page)
       */

      /* You can create as many of them as you want */
     
      LocalPortForwarder lpf1 = conn.createLocalPortForwarder(8080, "www.ethz.ch", 80);
     
      /* Now simply point your webbrowser to 127.0.0.1:8080 */
      /* (on the host where you execute this program)                         */

      /* ===== OK, now let's establish some remote port forwardings ===== */
     
      /* Example Port Forwarding: -R 127.0.0.1:8080:www.ganymed.ethz.ch:80 (OpenSSH notation)
       *
       * Specifies that the port 127.0.0.1:8080 on the remote server is to be forwarded to the
       * given host and port on the local side.  This works by allocating a socket to listen to port
       * 8080 on the remote side (the ssh server), and whenever a connection is made to this port, the
       * connection is forwarded over the secure channel, and a connection is made to
       * www.ganymed.ethz.ch:80 by the Ganymed SSH-2 library.
       *
       * (the above text is based partially on the OpenSSH man page)
       */

      /* You can create as many of them as you want */
     
      conn.requestRemotePortForwarding("127.0.0.1", 8080, "www.ganymed.ethz.ch", 80);

      /* Now, on the ssh server, if you connect to 127.0.0.1:8080, then the connection is forwarded
       * through the secure tunnel to the library, which in turn will forward the connection
       * to www.ganymed.ethz.ch:80. */

      /* Sleep a bit... (30 seconds) */
      sleepSomeTime(30000);

      /* Stop accepting remote connections that are being forwarded to www.ganymed.ethz.ch:80 */

      conn.cancelRemotePortForwarding(8080);

      /* Sleep a bit... (20 seconds) */
      sleepSomeTime(20000);

      /* Stop accepting connections on 127.0.0.1:8080 that are being forwarded to www.ethz.ch:80 */

      lpf1.close();
     
      /* Close the connection */

      conn.close();

 
View Full Code Here

    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        Utils.deleteRecursive(f);
        f.mkdirs();
        assertTrue(f.exists());

        String name = "test.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        name = "test2.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        assertTrue(f.delete());
        conn.close();
View Full Code Here

TOP

Related Classes of ch.ethz.ssh2.crypto.Base64

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.