AEM JSCH auth faill issue
I am facing a issue with JSCH working fine outside the AEM. But failing inside AEM.
JSch jsch = new JSch(); // Add the private key identity jsch.addIdentity(privateKeyPath); // Get a session session = jsch.getSession(username, host, port); // Configure session properties Properties config = new Properties(); // Important: For testing, you might set StrictHostKeyChecking to "no" // In production, it's recommended to handle known_hosts properly. config.put("StrictHostKeyChecking", "no"); session.setConfig(config); // Connect to the session session.connect(); System.out.println("Session connected.");
This works perfectly when I run it directly with main method ( outside osgi). But gives the below error when code is ran inside AEM.
com.jcraft.jsch.JSchException: Auth fail
at com.jcraft.jsch.Session.connect(Session.java:519)
at com.jcraft.jsch.Session.connect(Session.java:183)I ran the code with java 11 and AEM is also running on java 11. The code inside AEM is also able to access the private key content. ( I checked with log)
I am using the new library https://github.com/mwiede/jsch