Re: [JSch-users] jsch-0.1.54.jar throws com.jcraft.jsch.JSchException: invalid privatekey
Status: Alpha
Brought to you by:
ymnk
From: Tim B. <tb...@al...> - 2016-11-08 05:39:48
|
This is the 0.1.53 source: http://grepcode.com/file/repo1.maven.org/maven2/com.jcraft/jsch/0.1.53/com/jcraft/jsch/KeyPair.java#KeyPair Presumably the 0.1.54 source isn't much different, since the line numbers match exactly. Look at lines 634-665, and in particular lines 638-644. It looks like keys in formats DSA, RSA, ECDSA, and SSH are supported, but there's no indication that OPENSSH keys are supported. Did you maybe forget the "-t rsa" argument when generating the 4096-bit key? I'm not sure why the output would include "(RSA)" if that happened, but at the same time the content you showed us doesn't appear to be an RSA key... Tim On Mon, Nov 7, 2016 at 3:30 PM, Erik Wasser <eri...@na...> wrote: > On 07.11.2016 10:38, Lothar Kimmeringer wrote: > > > Hi, > > > > Am 04.11.2016 um 22:20 schrieb Erik Wasser: > > > >> Why is that? Why are 4096 bits RSA keys invalid? How can I fix this > issue? > > > > Maybe a limit of a JVM without Unlimited Strength Cryptography Extension > > being installed? > > Thanks for the feedback. > > I've download the file 'jce_policy-8.zip' > (http://www.oracle.com/technetwork/java/javase/downloads/jce8-download- > 2133166.html) > and extracted the files 'US_export_policy.jar' and 'local_policy.jar' > to the directory '/usr/java/jdk1.8.0_112/jre/lib/security' (overwriting > the old ones). > > Nothing changed (and I've double checked if this is the right java > version I'm using). > > If I switch to 'java-1.8.0-openjdk.x86_64' the error still remains so I > think it's not a (Oracle-)Java problem. > > Here's the stack trace: > > com.jcraft.jsch.JSchException: invalid privatekey: [B@282ba1e > at com.jcraft.jsch.KeyPair.load(KeyPair.java:664) > at com.jcraft.jsch.KeyPair.load(KeyPair.java:561) > at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40) > at com.jcraft.jsch.JSch.addIdentity(JSch.java:407) > at com.jcraft.jsch.JSch.addIdentity(JSch.java:367) > at UserAuthPubKey.main(UserAuthPubKey.java:29) > > I've debugged a little bit further and replaced the lines > > > -----BEGIN OPENSSH PRIVATE KEY----- > > ... > > -----BEGIN OPENSSH PRIVATE KEY----- > > with > > > -----BEGIN RSA PRIVATE KEY----- > > ... > > -----BEGIN RSA PRIVATE KEY----- > > And the stack trace changed a little bit: > > com.jcraft.jsch.JSchException: invalid privatekey: [B@f5f2bb7 > at com.jcraft.jsch.KeyPair.load(KeyPair.java:948) > at com.jcraft.jsch.KeyPair.load(KeyPair.java:561) > at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40) > at com.jcraft.jsch.JSch.addIdentity(JSch.java:407) > at com.jcraft.jsch.JSch.addIdentity(JSch.java:367) > at UserAuthPubKey.main(UserAuthPubKey.java:29) > > Any ideas? > > -- > So long... Erik > > > ------------------------------------------------------------ > ------------------ > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today. http://sdm.link/xeonphi > _______________________________________________ > JSch-users mailing list > JSc...@li... > https://lists.sourceforge.net/lists/listinfo/jsch-users > |