Ashish Patil
Ashish Patil

Reputation: 808

Apache Camel JSch privateKeyFile inside JAR

I am trying to upload a file using scp to remote server using Apache Camel JSch.

from("direct:report")
.to("scp://"+host+"/"+remotePath
   +"?username="+user
   +"&privateKeyFile="+privateKeyFile
   +"&strictHostKeyChecking=no");

This code works without error when I am keeping privateKeyFile on my file system and providing the path. But when I am putting my privateKeyFile inside the final executable JAR, what path should I give?

Upvotes: 0

Views: 313

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55525

Okay this may not be possible as the privateKeyFile is loaded by JCraft JSCH library and not by Apache Camel. And therefore JCraft may only support loading from the file system.

Looking into the source code it seems JCraft does not support loading the file in other ways. However we may be able to load the file via Camel and provide the content as a byte[] which it seems JCraft has an API we can leverage.

I have logged a ticket at Apache Camel: https://issues.apache.org/jira/browse/CAMEL-11738

Upvotes: 1

Related Questions