X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.core%2Fsrc%2Forg%2Fargeo%2Fsync%2Ffs%2FSshSync.java;h=7fe6670c9ef7627ad949b65ae0fdbbdb6cbca23e;hb=bc5e10532e11e384a47264fec26e8afe531654b6;hp=773f32d34e226dc3bbb70c3112c08c775f70eabe;hpb=810aecacb19916bade7e4bcfcbbb54c301f672df;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.core/src/org/argeo/sync/fs/SshSync.java b/org.argeo.core/src/org/argeo/sync/fs/SshSync.java index 773f32d34..7fe6670c9 100644 --- a/org.argeo.core/src/org/argeo/sync/fs/SshSync.java +++ b/org.argeo.core/src/org/argeo/sync/fs/SshSync.java @@ -27,8 +27,8 @@ import org.apache.sshd.client.channel.ClientChannelEvent; import org.apache.sshd.client.config.keys.ClientIdentityLoader; import org.apache.sshd.client.future.ConnectFuture; import org.apache.sshd.client.session.ClientSession; -import org.apache.sshd.client.subsystem.sftp.SftpFileSystem; -import org.apache.sshd.client.subsystem.sftp.SftpFileSystemProvider; +import org.apache.sshd.client.subsystem.sftp.fs.SftpFileSystem; +import org.apache.sshd.client.subsystem.sftp.fs.SftpFileSystemProvider; import org.apache.sshd.common.config.keys.FilePasswordProvider; import org.apache.sshd.common.util.io.NoCloseInputStream; import org.apache.sshd.common.util.io.NoCloseOutputStream; @@ -40,7 +40,7 @@ public class SshSync { try (SshClient client = SshClient.setUpDefaultClient()) { client.start(); - boolean osAgent = false; + boolean osAgent = true; SshAgentFactory agentFactory = osAgent ? new UnixAgentFactory() : new LocalAgentFactory(); // SshAgentFactory agentFactory = new LocalAgentFactory(); client.setAgentFactory(agentFactory); @@ -55,15 +55,15 @@ public class SshSync { System.out.print(keyPath + ": "); Scanner s = new Scanner(System.in); String password = s.next(); - KeyPair keyPair = ClientIdentityLoader.DEFAULT.loadClientIdentity(keyPath, - FilePasswordProvider.of(password)); - sshAgent.addIdentity(keyPair, "NO COMMENT"); +// KeyPair keyPair = ClientIdentityLoader.DEFAULT.loadClientIdentity(keyPath, +// FilePasswordProvider.of(password)); +// sshAgent.addIdentity(keyPair, "NO COMMENT"); } - List> identities = sshAgent.getIdentities(); - for (Map.Entry entry : identities) { - System.out.println(entry.getValue() + " : " + entry.getKey()); - } +// List> identities = sshAgent.getIdentities(); +// for (Map.Entry entry : identities) { +// System.out.println(entry.getValue() + " : " + entry.getKey()); +// } ConnectFuture connectFuture = client.connect(login, host, port); connectFuture.await();