Description
Hey there, I've been using sshj for some time, thanks for such nice tool and continue on your improvements!
I encounter a problem when I try to use ecdsa-sha2-nistp521 key. This could be duplicate issue but I couldn't find it from previous issues and in other public sources.
Here is the deal, I have a private ECDSA key and a remote server which I can connect successfully over ssh. While using sshj, I receive
Caused by: net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods
at net.schmizz.sshj.SSHClient.auth(SSHClient.java:230)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:345)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:363)
...
Here is how I try to do the magic
Config config = new DefaultConfig();
SSHClient sshClient = new SSHClient(config);
sshClient.loadKnownHosts();
...
//sshClient.addHostKeyVerifier(fingerprint); if available or after getting host key not verifyable
sshClient.connect("ssh-address-here", 22, proxy);
KeyProvider keyProvider = sshClient.loadKeys("path/to/private/key", "passphrase of private key");
sshClient.authPublickey("ssh-user-name", keyProvider);
Possibly related:
On my first trial of SSHClient creation, I receive the following (when calling connect(ip, port, poxy) method) and then I try to create with the fingerpint.
WARNING: HOST_KEY_NOT_VERIFIABLE: trusting fingerprint xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx: net.schmizz.sshj.transport.TransportException: Could not verify `ssh-ed25519` host key with fingerprint `xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx` for `x.x.x.x` on port 22
at net.schmizz.sshj.transport.KeyExchanger.verifyHost(KeyExchanger.java:211)
at net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:365)
at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:503)
at net.schmizz.sshj.transport.Decoder.decodeMte(Decoder.java:159)
at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:79)
at net.schmizz.sshj.transport.Decoder.received(Decoder.java:231)
at net.schmizz.sshj.transport.Reader.run(Reader.java:59)
I've tried adding BouncyCastle as
Security.addProvider(new BouncyCastleProvider());
however, it didn't change the result. If you can give a hand, it would be appreciated!
Specifications:
- JDK 1.8_202 ((JCE) Unlimited Strength is enabled by default)
- SSHJ 0.27
- BouncyCastle 1.60