Expectation Need to connect AWS server through Java code by using private key.
I was able to log in successfully until Red Hat 8 implemented in the server end. If I disable the FIS (Fuse Integration Service) then it works as expected.
I'm using IntelliJ for Java code.
Private key format is RSA 3 and I have converted into RSA 2 by using PuTTYgen.
Key pattern is
PuTTY-User-Key-File-2: ssh-rsa
Encryption:none
Comment: rsa-key-20220125
Public-Lines:12
AAAn23vnonBIhk......................
..................
....................................
Private-Lines:28
AACABdkfjal905 slknf................
....................................
Private-MAC: nbfajesrkkjnajfnga;alksdnfal;dks
Java code is
JSch jsch = new JSch();
jsch.addIdentity(privatekey)
Session session = jsch.getSession(username, hostname, port);
session.setConfig ("StrickHostKeyChecking","no")
session.connect();
I am always getting an error
com.jcraft.jsch.JSchException : Auth Fail
at com.jcraft.jsch.Session.connect(Session.java:519)
at com.jcraft.jsch.Session.connect(Session.java:183)