1
votes

I am facing a problem with UnknownHostKey: servername, when trying to verify the host key using:

jsch.setKnownHosts("target/hostname_keys");

Is it possible to use hostkey file in SSH2 format that looks like this

---- BEGIN SSH2 PUBLIC KEY ----
AAAAB3NzaC1kc3MAAACBAKKQ7hwq7
.....
w5Uw==
---- END SSH2 PUBLIC KEY ----

with JSch?

Is there some good libraries that can work with SSH2 keys?

1
@MartinPrikryl yea but it's different settings that i'm trying to pass to the program that one was about user auth private key this one is about how to point the hostname to resole the problem with UnknownHostKey: SERVERNAME. RSA key fingerprint - Vladimir Zaguzin

1 Answers

2
votes

JSch does not support public keys in this format.

But it's easy to convert that to known_hosts format.

Basically, just merge the lines into one and prepend a hostname:

example.com AAAAB3NzaC1kc3MAAACBAKKQ7hwq7...w5Uw==