Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.2.0, 2.3.0, 2.5.0, 2.4.0, 2.5.1
-
None
Description
Hello,
There's a bug for get the public key of a server from version 2.2.0.
On the version 2.1.0, it works :
Code :
SshClient client = SshClient.setUpDefaultClient(); client.start(); ConnectFuture connectFuture = client.connect("xxx", "xxx", 22); connectFuture.await(10000); ClientSession session = connectFuture.getSession(); session.waitFor(Arrays.asList(ClientSessionEvent.WAIT_AUTH), 10000); System.out.println(session.getKex().getServerKey().toString());
Result :
Sun RSA public key, 2048 bits modulus: xxx public exponent: 35
And with a higher version (example 2.5.1), the result is :
Exception in thread "main" java.lang.NullPointerException at test.test.main(test.java:27)
Line 27 is :
System.out.println(session.getKex().getServerKey().toString());