Let me rephrase the question (after having a better look at the code).
This is what I would like to do..
* I get the details of the machine to which I have to make a connection (From User).
* session.connect() throws a JschException
* Prompt the user whether to accept the fingerprint or not. If no, exit.
* Add the host key to the known hosts
* I'll do session.connect() again
I am stuck at the place where I can add the key to the known hosts.. Can anybody help?
I am new to Jsch. When I connect to a remote machine, it shows a popup saying "The authenticity of host <my host> can't be established....." Is there any way to supress this dialog box and get an exception thrown for this without modifying the jsch code. If I could get an exception, I can localize the dialog box and provide more details about the certificate.