Hi,
I noticed that when you call this method in JSch class:
  publicvoidaddIdentity(String name, byte[]prvkey, byte[]pubkey, byte[] 
passphrase) throwsJSchException
The method returns with the parameter prvkeyno longer to it's orignal value. 
Which makes it difficult to call this method many times (in case the 
credentials do not change and you wish to redo a connection) with the same 
prvKey since it is modified after the first call.

 
But if inside IdentityFileclass, in (privateIdentityFile(String name, byte[] 
prvkey, byte[] pubkey, JSch jsch) throwsJSchException), instead of doing :
byte[] buf=prvkey; (this does not prevent from modifying inside the method, the 
original passed parameter)
you do a :
byte[] buf = new byte[prvkey.length];
System.arraycopy(prvkey, 0, buf, 0, prvkey.length);You’ll operate on a copy, 
and the original remains intact at the end of the method.

What I do now is calling the addIdentity by giving it a copy of my private key 
prvkey ( a copy by System.arraycopy, before calling the method).
Hoping I've been clear.
Regards,
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to