Hi, I'm working on an interactive SSH Client which supports Public-Key-Authentication. This worked fine until newer Versions of jsch (perhaps it worked until 0.1.48, I don't know when I tested it the last time). I am able to load private keys, but I can't unload them again.
$ pwd /tmp/ssh $ ssh-keygen -f /tmp/ssh/id_rsa -N password > /dev/null $ rm id_rsa.pub $ ls id_rsa jsch-0.1.49.jar Test.java $ cat Test.java public class Test { public static void main(final String[] args) throws Exception { final String keyfile = "/tmp/ssh/id_rsa"; final com.jcraft.jsch.JSch jsch = new com.jcraft.jsch.JSch(); System.out.println(jsch.getIdentityNames().size()); // 0 jsch.addIdentity(keyfile); System.out.println(jsch.getIdentityNames().size()); // 1 System.out.println(jsch.getIdentityNames().get(0).equals( keyfile)); // true jsch.removeIdentity(keyfile); System.out.println(jsch.getIdentityNames().size()); // 1 } } $ javac -cp jsch-0.1.49.jar Test.java && java -cp jsch-0.1.49.jar:. Test Note: Test.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 0 1 true 1 I know that removeIdentity(String) is deprecated and I would use removeIdentity(Identity) instead. But I found no way to enumerate all Identities (I only know getIdentityNames) and by looking at the source of removeIdentity(Identity) I assume the problem would be the same. What is the correct way to load and unload private keys? Is this only possible if the public key resists in the same directory? Thank you! Jochen Wierum ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ JSch-users mailing list JSch-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jsch-users