Hi

Yeah if sftp accepts an InputStream for the private key file, then we
can use the resource loader abstraction to load it from classpath and
file systems.

See: org.apache.camel.util.ResourceHelper#resolveMandatoryResourceAsInputStream

This is what we do in other components.

This will help with this use-case.


If there is a demand for implementing custom jsch interfaces, then we
can take a look at that also. But I think being able to load the key
files from classpath is a good idea to get sorted first.







On Fri, Jun 21, 2013 at 6:50 AM, Siano, Stephan <stephan.si...@sap.com> wrote:
> Hi,
>
> You are right, the current implementation doesn't work with identity and 
> known hosts files from anywhere but the file system. JSch has actually three 
> ways of setting these entities, one with a filename (which camel uses now), 
> one with an InputStream and one with implementations of the Identity and 
> KnownHostsRepository interfaces. Behind the scenes JSch is using the default 
> implementation of these interfaces that are capable of parsing files in the 
> OpenSSH format. My idea was to extend camel in a way that it's also possible 
> to pass objects implementing these interfaces to the endpoint, so you could 
> get your key material from wherever you want (e.g. a database or a file in a 
> different format), however on a second thought this has two disadvantages.
> 1. The camel component would expose interfaces from the underlying JSch 
> implementation.
> 2. The default implementation from JSch have private constructors, so we 
> should at least also offer an InputStream interface as we most likely do not 
> want to parse these files ourselves...
>
> Claus: what do you think would be best?
>
> Best regards
> Stephan
>
> -----Original Message-----
> From: javamonkey79 [mailto:javamonke...@gmail.com]
> Sent: Donnerstag, 20. Juni 2013 22:11
> To: users@camel.apache.org
> Subject: RE: camel sftp privateKeyFile - load from classpath
>
> @Stephan - that is a bit over my head, perhaps I don't understand the sftp
> component and jsch well enough yet. What I do know is that jsch is taking
> the String param passed in via Camel (the fileName param) and turning that
> in to a File, which I don't think will work with classpath resources? There
> is a another method in the jsch Util class that loads in by bytes instead -
> or perhaps camel is not calling the Util class at all, I'm not sure.
>
> If someone could point me at the spot where camel hooks the keyfile in to
> jsch I'd be happy to take a shot at improving it if possible.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-sftp-privateKeyFile-load-from-classpath-tp5734394p5734460.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to