test ed25519 public key

This commit is contained in:
Jörg Prante 2022-11-16 17:50:30 +01:00
parent 6a8226af8c
commit 1af5f2c928

View file

@ -39,7 +39,7 @@ public class SFTPFileSystemTest {
env.put("username", "joerg");
URI uri = URI.create("sftp://xbib.org");
SshClient sshClient = ClientBuilder.builder().build();
Path privateKey = Paths.get("/Users/joerg/.ssh/id_ed25519");
Path privateKey = Paths.get(System.getProperty("user.home") + "/.ssh/id_ed25519");
KeyPairProvider keyPairProvider = new FileKeyPairProvider(privateKey);
keyPairProvider.loadKeys(null).forEach(sshClient::addPublicKeyIdentity);
for (String keyType : keyPairProvider.getKeyTypes(null)) {
@ -50,6 +50,7 @@ public class SFTPFileSystemTest {
sshClient.setNioWorkers(1);
sshClient.start();
SftpFileSystem fileSystem = new SftpFileSystemProvider(sshClient).newFileSystem(uri, env);
fileSystem.close();
// ...
sshClient.stop();
}