Guest User

Untitled

a guest
Dec 10th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. PuTTY-User-Key-File-2: ssh-rsa
  2. Encryption: none
  3. Comment: rsa-key-test
  4. Public-Lines: 12
  5. ...
  6. Private-Lines: 28
  7. ...
  8.  
  9. ---- BEGIN SSH2 PUBLIC KEY ----
  10. Comment: "rsa-key-test"
  11. ...
  12. ---- END SSH2 PUBLIC KEY ----
  13.  
  14. jsch.setKnownHosts(filePath + "known_hosts");
  15.  
  16. 2018-12-07 15:22:14.900 [main] INFO d.p.o.common.clients.SftpClient - com.jcraft.jsch.JSchException: invalid privatekey: [B@8e0379d
  17.  
  18. Jsch jsch = new JSch();
  19. Session session = null;
  20.  
  21. //add known hosts file for authentication
  22. jsch.setKnownHosts(filePath + "known_hosts");
  23.  
  24. keyPath = filePath + "privatekey.ppk";
  25. jsch.addIdentity(keyPath);
  26. session = jsch.getSession("test", "172.17.30.91", 22);
  27.  
  28. session.connect();
Add Comment
Please, Sign In to add comment