hierynomus / hierynomus/sshj

NullPointerException thrown from AbstractDHG

Open
#451 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.7k
Forks
620
Avg merge
3d 23h
Merged PRs (30d)
11

Description

I attempted to create an SSHClient to connect to Vagrant VM. I can use openSSH to connect via this command and entering the password:

```
ssh vagrant@10.252.97.145
```
However, using the same credentials to create an SSHClient, the connection fails with a NullPointerException on [line 83 of class AbstractDHG](https://github.com/hierynomus/sshj/blob/master/src/main/java/net/schmizz/sshj/transport/kex/AbstractDHG.java#L83).

It turns out that in the line before that, KeyType.fromKey(hostKey) is returning KeyType.UNKNOWN for this value of hostKey:

```
EC Public Key\n X: 148ed4eed4b92764f547cd91022803796255401d085b91505eb22653032d381\n Y: 2257314cec1ab825bc4f16945a828ad6fb1ba223018640e2e82d36f6e883a65d\n
```

With KeyType.UNKNOWN, ```Factory.Named.Util.create``` returns null.

There are two problems here, I think. First, why is my hostKey not handled? Second, AbstractDHG needs to check for a null return value and provide a more reasonable exceptoin.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.