Discussion:
[JSch-users] Ant sshexec task error when using key
Steve Anderson
2014-01-07 01:12:57 UTC
Permalink
Using ant 1.8.3, with jsch 0.1.50, when I try to use a key, I get the
following error:

build.xml:34: com.jcraft.jsch.JSchException: privatekey: aes128-cbc is not
available [***@632dde87
at com.jcraft.jsch.KeyPair.load(KeyPair.java:663)
at com.jcraft.jsch.KeyPair.load(KeyPair.java:542)
at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40)
at com.jcraft.jsch.JSch.addIdentity(JSch.java:389)
at com.jcraft.jsch.JSch.addIdentity(JSch.java:349)
at
org.apache.tools.ant.taskdefs.optional.ssh.SSHBase.openSession(SSHBase.java:212)
at
org.apache.tools.ant.taskdefs.optional.ssh.SSHExec.execute(SSHExec.java:236)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

I have verified my local JRE (1.7) policy allows all encryptions. I can
use the key for connecting via ssh at the command line. I can also use the
UserAuthPubKey example included in jsch to connect.

Any ideas?

Steve
--
steve.anderson at gmail.com
Atsuhiko Yamanaka
2014-02-27 08:30:01 UTC
Permalink
Hi,

+-From: Steve Anderson <***@gmail.com> --
|_Date: Mon, 6 Jan 2014 17:12:57 -0800 _____________
|
|Using ant 1.8.3, with jsch 0.1.50, when I try to use a key, I get the
|following error:
|build.xml:34: com.jcraft.jsch.JSchException: privatekey: aes128-cbc is not
|available [***@632dde87
| at com.jcraft.jsch.KeyPair.load(KeyPair.java:663)
...
|I have verified my local JRE (1.7) policy allows all encryptions. I can
|use the key for connecting via ssh at the command line. I can also use the
|UserAuthPubKey example included in jsch to connect.

We have not found the reason for that exception. The cipher method 'aes128-cbc'
should be available on Java7 by the default.
If you have the scala command, try the following,
$ scala -classpath ./jsch-0.1.50.jar
Welcome to Scala version 2.10.1 (Java HotSpot(TM) Client VM, Java 1.6.0_29).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import com.jcraft.jsch._
import com.jcraft.jsch._
scala> new jce.AES128CBC
scala> res0.init(Cipher.ENCRYPT_MODE, new Array(res0.getBlockSize()), new Array(res0.getIVSize()))
It seems 'res0.init(...)' has thrown some exception on your environment.


Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
Skype callto://jcraft/
Twitter: http://twitter.com/ymnk
Facebook: http://facebook.com/aymnk

Loading...