karthik - 2015-12-05

Hi all,

Please help me with the following

I am using .52 version with Java 7. Trying to do scp to a box which is FIPS enabled.

The exception I am getting is

com.jcraft.jsch.JSchException: Session.connect: java.security.SignatureException: Signature encoding error
at com.jcraft.jsch.Session.connect(Session.java:558)
at com.jcraft.jsch.Session.connect(Session.java:183)

Program

public static Session getJschSession(final String hostname, final String username,
final String password) {
//Security.addProvider(new BouncyCastleProvider());
final JSch jsch = new JSch();
Session session = null;

    JSch.setLogger(new JSCHLogger());

    try {
        session = jsch.getSession(username, hostname, 22);
        session.setPassword(password);
        final java.util.Properties config = new java.util.Properties();
        config.put(
                "kex",
                "ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256");
        config.put("StrictHostKeyChecking", "no");

        session.setConfig(config);

        session.connect();

        System.out.println("Session Connect Successful....!");

    } catch (final Exception e) {
        e.printStackTrace();
    }

Thanks and regards
Karthik