Re: [JSch-users] jsch-0.1.54.jar throws com.jcraft.jsch.JSchException: invalid privatekey
Status: Alpha
Brought to you by:
ymnk
From: Erik W. <eri...@na...> - 2016-11-07 22:31:07
|
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 |