IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

SFTP implemention with Jcraft -- Advise needed on authentication with certs

  • 1.  SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Wed February 02, 2011 03:13 PM

    Hi All,

    We are implementing SFTP in wM 7.1 using jcraft.
    I could write the java service to logon to SFTP server with username/pwd authentication.

    But, I need authentication with both certs and username/pwd.
    Could any one please help me out here how I can write java code for this with jcraft SSH.

    Thanks,
    Venkat


    #Integration-Server-and-ESB
    #webMethods
    #webmethods-Protocol-and-Transport


  • 2.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Fri February 04, 2011 10:06 PM

    Why do you need java code for this? can’t you use pub/ftp services (with sftp mode) and certificates configured?


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 3.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Mon February 07, 2011 07:28 AM

    Hi RMG,

    Firstly, thanks a lot for looking into my thread.

    I am a bit confused with your post here.
    I read that wM do not support SFTP out of the box and it only supports FTPS from V 6.5.
    This is the reason why we are considering jcraft to implemeny sftp in wM.
    we could logon to sftp server with a piece of java code using jcraft ssh and authentication being username/pwd.

    Could you please more elaborate on your post.

    “can’t you use pub/ftp services (with sftp mode) and certificates configured?”

    Do you mean wM supports sftp?
    I believe/read that pub/ftp service works in ftps mode and not in sftp mode.
    If I have to use public key also along with the username/pwd for authentication while logging in to sftp server, what we have to do?
    I thought that we need to write java service similar o wht I wrote to logon to sftp server (wuth being username/pwd).
    As I could not succeed in writting a java code for public key authentication, I reached out to t he forum.

    Please correct me if I am heading in a wrong direction.

    Thanks,
    Venkat.


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 4.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Tue March 15, 2011 08:48 AM

    Hi Venkat,

    I have written the java code (JCRAFT JSCH) to put file via SFTP using both password and public/private key authentication from a same java service.

    Let me know if you need it now.

    Regards,

    Arpith


    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB
    #webMethods


  • 5.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Fri June 26, 2020 08:58 AM

    Hi wm_member,
    can you please send me copy of jar (JCRAFT JSCH) to yac.bouider@gmail.com or tell me where i can dawnload it?
    I’me using IS 10.3 but the same problem, we can’t use both SSH key and password user
    regards


    #Integration-Server-and-ESB
    #webMethods
    #webmethods-Protocol-and-Transport


  • 6.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Tue March 15, 2011 08:55 AM

    Hi Arpith,

    It would be of great help if you can kindly share your java code with me.

    Thanks,
    Venkat


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 7.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Tue March 15, 2011 09:12 AM

    Hi Venkat,

    PFA the code …

    Input of the service:

    pathFileName: basically source path where the file is existing.
    destpath : destination path
    destFile : filename you want to be put intop the location
    prvKeyPath: path where you have your private key
    prvKeyPassPhrase: if you have any passphrase setup for private key

    let me know if you see any issue as this code is working perfectly in my project and is a part of the framework.

    regards,

    Arpith
    JSCH.txt (3.16 KB)


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 8.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Tue March 15, 2011 09:33 AM

    Hi Arpith,

    Thanks a lot for the quick reply.
    I will go through the service and will come back if I face any issues.

    And Arpith, Could you please let me know your thoughts on the below scenario of ours.
    We have a requirement to implement SFTP in webMethods 7.1.2 and we suggested our client to use jcraft jsch and told the client that this is an open source software. Now, our client is insisting not to use open source software as they are seeing a risk of getting no technical support in case of any issues with open source softwares. So, they insisted to go for a licensed software to implement sftp in wM. We did a little research and selected ws_ftp tool.
    Could you please let me know your thoughts on this, like, how risky is using open source softwares such as jcraft and feed back on ws_ftp tool if you have any idea on it.

    Thanks,
    Venkat


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 9.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Tue March 15, 2011 10:25 AM

    Hi Venkat,

    I don’t see any major drawbacks of using Jcraft JSCH … apart from getting technical support which still I feel the Java experienced guys can help you with that as lot of code is available on net.

    My client have a huge webMethods implementation and they don’t feel any issue with using open source softwares…

    I personally don’t have any experience on using ws_ftp tool so can’t comment on that …


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 10.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Tue April 26, 2011 08:18 AM

    Hi Arpith,

    I am very new to webMethods. I was created a java service by using the code you are providing. I am getting the following error while saving the service.
    "cannot find symbol
    symbol : method addIdentity(java.lang.String,byte[],,byte[])
    location: class com.jcraft.jsch.JSch
    jsch.addIdentity( "

    I know some where I did a mistake, Please guide me to achieve this.

    Thanks in Advance


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 11.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Wed May 11, 2011 02:17 PM

    Dear vsomu,

    Welcome to webMethods world … and u will have a nice time working on webMthods platform …

    I am not much experience on Java but here You have not imported the jsch jar files into webMethods IS. Please import the jars and compile your code again …

    cheers …


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 12.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Fri June 26, 2020 09:59 AM

    HI,
    I finaly found jar com.jcraft.jsch_0.1.27.jar, i have another problem
    can you please, tell me what is pub.CommonUtils, is there any jar for that?

    regards,


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 13.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Wed June 22, 2011 05:04 PM

    Hi Arpith,

    In the email thread you say - “I have written the java code (JCRAFT JSCH) to put file via SFTP using both password and public/private key authentication from a same java service.”

    I am also implementing the exact same thing and would very much appreciate being able to check out your source code on this. So please send me a copy to joneyre@att.com

    Thank you very much.

    Regards Jon


    #Integration-Server-and-ESB
    #webMethods
    #webmethods-Protocol-and-Transport


  • 14.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Fri April 25, 2014 01:49 AM

    Hi Arpith,

    Need your assist to brief me your java code below. I’m newbie to webMethod also and now i need to do FTPJobs to connect sFTP server with only Private Key File provided. I have tried your Java Code provided, but i can’t get any result returned for ChannelSftp, SessionFactory & status.

    May i know what is “PassPhrase” in below? Is that means password for the UserID? And for privateKey, what value i should input? Is that the location path of the PrivateKey file?

    jsch.addIdentity(  
    ftpUserName,    // String userName            
    prvkey,         // byte[] privateKey             
    null,            // byte[] publicKey            
    PassPhrase );  // byte[] passPhrase
    

    Look forward your assist reply. I’m urge to complete the FTPJobs :wink: Thanks very much on this.
    or you can email me to nicholaz4u@gmail.com


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 15.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Fri April 25, 2014 01:25 PM

    If you are using WM 9.0 or newer, SFTP is supported natively (check pub.client.sftp folder).

    If you are using older version, jsch is easy to implement.

    Passphrase is used to secure your SSH key, when you generate the SSH key, you give a passphrase.


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 16.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Thu May 22, 2014 07:57 AM

    Hi Tong Wang,

    Thanks alot of your guideline reply at here. Sorry for my late reply because busy on some other works.
    The code wasn’t run from my platform, i not able get sFTP connection result.
    I’m using webMethod ver 8.2 SP1.

    I have hit with error on below, may i know what value should i give for privateKey? Is that the full path pointed to the Private Key that i have stored at (can give example)?

    jsch.addIdentity(  
    ftpUserName,    // String userName            
    prvkey,         // byte[] privateKey             
    null,            // byte[] publicKey            
    PassPhrase );  // byte[] passPhrase
    

    Currently in my webMethod has one sFTP module (BW_Utilities.ftp.sftp:login) which is only serve for (Host, Port, UserName & Password), but then for my project i only allow to use Private Key connection due to security reason. Hope my doubt here can be solve. Very much appreciate your help.


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 17.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Thu May 22, 2014 08:23 AM

    Below is the error that i have when i tried with
    jsch.addIdentity(prvkeyStr);

    D:\WM8_2\IntegrationServer\packages\BW_Utilities\code\source\BW_Utilities\ftp\sftp.java:482: unreported exception com.jcraft.jsch.JSchException; must be caught or declared to be thrown
    jsch.addIdentity(prvkeyStr);
    ^
    1 error


    #Integration-Server-and-ESB
    #webMethods
    #webmethods-Protocol-and-Transport


  • 18.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Thu May 22, 2014 11:35 AM

    If I remember correctly, there are a few addIdentity methods you can call. one of them:
    jsch.addIdentity(privateKeyFile, publicKeyFile, passPhrase
    .getBytes());
    which you should provide the file path for both private key file and public key file.
    Note the key should be a RSA key.
    you can use PuttyGen to generate a pair of public/private key with given passphrase
    puttygen can be downloaded from:

    for your error, you need to have a try-catch around your code, and catch JSchException


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 19.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Tue December 12, 2017 02:55 PM

    Hi,

    a bit late, but just some remarks to sort things out:

    FTPS is not equal to SFTP.
    FTPS uses FTP protokoll SSL for transport and SFTP uses SSH protocol for transport.

    FTPS = FTP over SSL
    SFTP = FTP over SSH

    FTP (and FTPS) have been supported by webMethods quite early, but SFTP has been introduced with 9.x incorporating a SAG Consulting solution which was known as WmSSH2 Package.

    Regards,
    Holger


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 20.  RE: SFTP implemention with Jcraft -- Advise needed on authentication with certs

    Posted Fri June 26, 2020 03:44 PM

    pub.CommonUtils is part of WmPublic. you can find it under: IntegrationServer\packages\WmPublic\code\classes\pub


    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB
    #webMethods