How to get a specific type of key from a ssh server in C/CPP? [closed]
Solution 1:
Imo, ssh-keyscan
connects once for every key type it supports, trying to agree on that key. If that succeeds, it prints the key, if not, it proceeds with another.
What makes the code complicated is that it does all the connections in paralel in a single thread. If you implement it sequentially, it will be way more simpler.