Making SFTP connection in SSH2 mode

I need to to make an SFTP connection to an SFTP site with the SSH2 mode using Java code in PL/SQL developer.
And the connection requires an RSA key to start with. We got the RSA key, but I have some trouble with the code.
Below is the code I've got so far, and I don't know how to turn on the SSH2 mode, and I don't know how to include the RSA key:
public static void SFTP_Login (java.lang.String inSite, int inPort, java.lang.String inUser_ID, java.lang.String inPassword)
throws Exception
System.setProperty("java.net.preferIPv4Stack", "TRUE");
try
conn = new Connection(inSite, inPort);
conn.connect();
String[] auth = conn.getRemainingAuthMethods(inUser_ID);
boolean tKeyboardInteractive = false;
boolean tPasswordAuthentication = false;
int i;
for (i = 0; i < auth.length; ++i)
if (auth.equals("password")) {
tPasswordAuthentication = true;
} else if (auth[i].equals("keyboard-interactive")) {
tKeyboardInteractive = true;
boolean isAuthenticated = false;
if (tPasswordAuthentication) {
isAuthenticated = conn.authenticateWithPassword(inUser_ID, inPassword);
} else if (tKeyboardInteractive) {
ki.response = inPassword;
isAuthenticated = conn.authenticateWithKeyboardInteractive(inUser_ID, ki);
if (isAuthenticated == false)
throw new IOException("Authentication failed.");
catch(Exception ex)
SFTP_Logout_JAVA();
throw(ex);

Duplicate of SFTP connection with SSH2 mode .

Similar Messages

  • SFTP connection with SSH2 mode

    I need to to make an SFTP connection to an SFTP site with the SSH2 mode using Java code in PL/SQL developer.
    And the connection requires an RSA key to start with. We got the RSA key, but I have some trouble with the code.
    Below is the code I've got so far, and I don't know how to turn on the SSH2 mode, and I don't know how to include the RSA key:
    public static void SFTP_Login (java.lang.String inSite, int inPort, java.lang.String inUser_ID, java.lang.String inPassword)
    throws Exception
    System.setProperty("java.net.preferIPv4Stack", "TRUE");
    try
    conn = new Connection(inSite, inPort);
    conn.connect();
    String[] auth = conn.getRemainingAuthMethods(inUser_ID);
    boolean tKeyboardInteractive = false;
    boolean tPasswordAuthentication = false;
    int i;
    for (i = 0; i < auth.length; ++i)
    if (auth.equals("password")) {
    tPasswordAuthentication = true;
    } else if (auth.equals("keyboard-interactive")) {
    tKeyboardInteractive = true;
    boolean isAuthenticated = false;
    if (tPasswordAuthentication) {
    isAuthenticated = conn.authenticateWithPassword(inUser_ID, inPassword);
    } else if (tKeyboardInteractive) {
    ki.response = inPassword;
    isAuthenticated = conn.authenticateWithKeyboardInteractive(inUser_ID, ki);
    if (isAuthenticated == false)
    throw new IOException("Authentication failed.");
    catch(Exception ex)
    SFTP_Logout_JAVA();
    throw(ex);
    }

    Thanks for your answer..
    There is nothing to keep secret from, But I just didn't get more detailed error message than this:
    ORA-29532: Java call terminated by uncaught Java exception: java.io.IOException
    I really wish I was able to get more specific error msgs, so that I can better debug the issue.
    Do you know if connecting to an SFTP site using SSH2 mode with RSA keys need any special Java libraries?
    In other words, maybe I need to Import other java libraries?
    These are the ones I'm already importing:
    import com.trilead.ssh2.Connection;
    import com.trilead.ssh2.SFTPv3Client;
    import com.trilead.ssh2.SFTPv3FileHandle;
    import com.trilead.ssh2.SFTPv3DirectoryEntry;
    import com.trilead.ssh2.InteractiveCallback;
    import org.apache.commons.net.ProtocolCommandListener;
    import org.apache.commons.net.ProtocolCommandEvent;
    import org.apache.commons.net.ftp.FTP;
    import org.apache.commons.net.ftp.FTPConnectionClosedException;
    import org.apache.commons.net.ftp.FTPReply;
    import org.apache.commons.net.ftp.FTPSClient;
    import org.apache.commons.net.ftp.FTPFile;
    Thank you,

  • My iphone 3g is stuck on the connect to itunes mode and it wont show up on itunes. itunes hasnt even detected it on recovery mode. what do i do i really need my phone.. please help

    my iphone 3g is stuck on the connect to itunes mode and it wont show up on itunes. itunes hasnt even detected it on recovery mode. what do i do i really need my phone.. please help

    Please stop altering the fonts, it makes reading postings extremely difficult.  If help is desired, making postings difficult to read is not the way to get help.
    Put the device in DFU mode (google it), then restore.

  • I have an iMac (Mid 2010) and am running 0sx 10.8.5 and the WiFi always loses connection during sleep mode. I have seen numerous different solutions none of which seem to work. Can anyone help?

    I have an iMac (Mid 2010) and am running 0sx 10.8.5 and the WiFi always loses connection during sleep mode. I have seen numerous different solutions none of which seem to work. Can anyone help?

    Test after taking each of the following steps that you haven't already tried. Back up all data before making any changes.
    1. Make sure the network is on the preferred list by following these instructions. It's important to read the article carefully, as it's the starting point for any further efforts to solve the problem. If you skip any of the steps, the problem may not be solved. Make sure the box marked
              Remember networks this computer has joined
    is checked.
    2. Follow the instructions in this support article under the heading
              Symptom: After restarting or waking from sleep, my computer might not connect to the Internet
    3. Reset the PRAM.
    4. Make a note of all your settings for Wi-Fi in the Network preference pane, then delete the connection from the connection list and recreate it with the same settings. You do this by clicking the plus-sign icon below the connection list, and selecting Wi-Fi as the interface in the sheet that opens. Select Join other network from the Network Name menu, then select your network. Enter the password when prompted and save it in the keychain.
    5. From the Location menu at the top of the Network preference pane, select Edit Locations. A sheet will drop down. Click the plus-sign button to create a new location. Give it any name you want. In the new location, set up the Wi-Fi service with the same settings you used before. Click Apply and test.
    6. Launch the Keychain Access application. Search for and delete all AirPort network password items that refer to the network. Make a note of the password first.
    7. Repair permissions on the startup volume.
    8. Turn off Bluetooth and test.
    9. Reset the System Management Controller.
    10. This step shouldn't be necessary, but has been advised by Apple Support in some cases, apparently as a workaround for a bug. Open the Energy Saver pane in System Preferences. If applicable, click the padlock icon in the lower left corner to unlock the settings. Enter your administrator login password when prompted.
    Select the Power Adapter tab and uncheck the boxes marked
              Wake for Wi-Fi network access
    and
              Enable Power Nap...
    if present. Then, if the computer is a MacBook, select the Battery tab and uncheck
              Enable Power Nap...
    11. Reinstall OS X.

  • Can't establish a sftp connection with the finder

    Hi, I'm trying to establish a sftp connection with the finder (using the "Connect to server" feature) between my (recently purchased) Mac Mini (mid 2011: i5, 2.3 GHz, 2 GB, running 10.7.3) and a Debian Testing box and I can't, I get the following error:
    'There was a problem connecting to the server "ip.address"
    This file server will not allow any additional users to log on. Try to connect again later.'
    However if I try establishing a connection from the terminal (either ssh or sftp) it works flawlessly:
    SSH:
    victoria:~ RonIn$ ssh [email protected]
    [email protected]'s password:
    Linux clementine 3.0.0-1-486 #1 Sat Aug 27 15:56:48 UTC 2011 i686
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    You have new mail.
    Last login: Sat Apr 28 21:52:18 2012 from ukamy.local
    ronin@clementine:~$
    SFTP:
    victoria:~ RonIn$ sftp [email protected]
    [email protected]'s password:
    Connected to ip.address.
    sftp>
    I've searched for a fix or alternative on the internet and I haven't found one that works; The one that keeps coming up is to try: "ftps" as the protocol instead of "sftp" with the remaining information the same (it doesn't work, it gets the same error message afterwards).
    The IP address and login information works (corroborated by the fact that I can log in from the terminal from the Mac Mini) so the only issue is with the finder capabilities for establishing the connection. I have looked for apple related documentation or How Tos but I haven't found anything useful.
    I don't want to use any third party app or tweak because of the sensitive information that is going to be transfered, I would like to be using strictly the tools from the OS.
    If you need any more information please let me know, any help is deeply appreciated.

    I have the same issue although i kind of fixed it. I have two admin accounts and one of the account's safari did the same thing as yours, except, it was the startpage and everypage i tried to visit. I reseted safari, as in the erase all data safari in the toolbar, safari-Reset Safari... But safari still didn't work. I logged out and went to my other account and opened safari. Now it works fine on both accounts. This meant safari had to logout before actually working better. I have this a few times these days.

  • ATV & D-Link DIR-655 (Not connecting in N Mode)

    Hopefully someone can explain this to me.
    The D-Link DIR-655 does not connect to the ATV in N-mode, only in G.
    I don't see anything in the ATV to force a N-mode connection.
    Are these 2 unit compatible in N-Mode or do I have to have the new Airport Extreme unit to accomplish this.
    Or is there a particular setting that the D-Link unit needs to have to accomplish this connection.
    Looking forward to your replies.

    do you have any other wireless devices that connect in "n" mode?
    have you checked your router to make sure that "n" mode is enabled ?
    i know in mine you can restrict it to "g" or "b and g" so maybe yours has something similar and "n" isn't activated.

  • My ipod went to the ''connect to itunes mode'' and i want to use my itunes backup but how can i do that. also when the ''recover your ipod screen'' appeared i accidentally chose not to show it anymore.

    My ipod went to the ''connect to itunes mode'' and i want to use my itunes backup but how can i do that. also when the ''recover your ipod screen'' appeared i accidentally chose not to show it anymore. please help i just had it for half a day.

    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...  Be sure to Follow ALL the Steps...
    Take your time... Pay particular attention to Steps 3 and 4.
    Some users have reported as many as 8 or 9 attempts were necessary before success.
    If the issue persists...
    Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step...
    Be sure to make an appointment first...

  • How do I get a factory unlocked iPhone 3GS out of (connect to iTunes) mode?

    How do I get a factory unlocked iPhone 3GS out of recovery (connect to itunes) mode? 
    Once the iPhone 3GS is in DFU mode and plugged into iTunes, the restore and update process begins. The restores process are as followed:
    Extracting software > Preparing iPhone for restore (blank screen) > Preparing iPhone software for restore > Restoring iPhone software > Verifying iPhone restore > Restoring iPhone firmware > The iPhone cannot be restored. An unknown error occurred (1).
    I clicked on the more information tab and was taken to a website with some troubleshooting. I did what they suggested (based on the error #) and still no luck. I’ve tried to restore and update about 10 times now but the same message keeps coming up at the end. What should I do now?
    P.S: I have the latest version of iTunes (11), my windows is up to date etc ...

    CDiiva wrote:
    The iPhone cannot be restored. An unknown error occurred (1).
    This Error message is indicative of a Hardware issue. The device may need Service.

  • I hope this might interest someone. The situation; 3 floors,I am having trouble with an an Airport Extreme, 802.11n on the top floor and a Mac Pro 3.1 on the bottom floor. Not always but often it has trouble seeing the Airport and making a connection. I h

    I'm not sure how to post a message. I hope this might interest someone. The situation; 3 floors,I am having trouble with an an Airport Extreme, 802.11n on the top floor and a Mac Pro 3.1 on the bottom floor. Not always but often it has trouble seeing the Airport and making a connection. I have an older Airport Express, would it help to install it? would it work best if it was installed in the same room? should it be installed half way in between? Get another Extreme? The Mac Book Pro on the middle floor can see 11 networks in the neighbourhood if that might be causing a problem or would if I installed the Express. Thank for your consideration.   

    Thanks for your time ... I appologize for the font and colour, I compossed the question in pages and failed to notice the font colour as grey ... there are a variety of computers of various ages so I think it is using a setting that allows both 5G and 2.4 ... the connection to the Airport is thru a cable modem and cable does run throuhout the house ... maybe those hard wires would be a place to look at ... do you think that putting the 'Express' on the second floor might help ... thanks again ...

  • HT4097 my ipad 3 is stuck in the "connect to itunes" mode. whether i restart or try to restore. when i try to restore itunes gives an error message saying an unknown error occurred (-1). any help.

    my ipad 3 is stuck in the "connect to itunes" mode. whether i restart or try to restore. when i try to restore itunes gives an error message saying an unknown error occurred (-1). any help.

    That error sometimes indicates a hardware problem. See 2nd link below.
    Update and restore alert messages on iPhone, iPad, and iPod touch
    http://www.buybuyla.com/tech/view/012953a0d412000e.shtml
    iOS: Resolving update and restore alert messages
    http://support.apple.com/kb/TS1275
    iPad: Unable to update or restore
    http://support.apple.com/kb/ht4097
    Take it to an Apple Store for evaluation.
    Make a Genius Bar Reservation
    http://www.apple.com/retail/geniusbar/
     Cheers, Tom

  • My ipod touch 4th generation's audio jack is no longer making a connection with my headphones, i dont think my ipod is under warranty and therefor would i be able to pay apple to fix my ipod.

    My ipod touch 4th generation's audio jack is no longer making a connection with my headphones, i dont think my ipod is under warranty and therefor would i be able to pay apple to fix my ipod.

    If not under warranty,
    Apple will exchange your iPod for a refurbished one for $199 for 64 GB 4G and $99 for the other 4Gs. They do not fix yours.
    Apple - iPod Repair price                       
    A third-party place like the following will replace the jack for less less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens         
    Replace the jack yourself if you are up to it
    iPod Touch Repair – iFixit                  

  • How to configure FTP/VAN Adapter for SFTP connection?

    Hi,
    I am new to the use of Seeburger's FTP/VAN adapter. I read SDN threads where the FTP/VAN adapter can be used for SFTP connections. Could anyone assist me in the steps to configure the communication channels for SFTP connections?
    Scenarios:
    1. R/3 -> XI -> File (SFTP server)
    2. File (SFTP server) -> XI -> IDoc
    There is no VAN connection involved. I am just trying to utilize the adapters my PI system currently have for my interface requirement.
    Is the configuration as simple as configuring the communication channel or there are scripts involved? If there are scripting involved, is there a benefit to use scripting in the FTP/VAN adapter, rather than XI's own File adapter?
    Please assist. Thank you.

    Hi Andrew,
    Standard PI Adapter will not support to conenct SFTP server, we have to use third party adapters?? do you have any third party adapters??
    many compniaes providing SFTP adapters and SAP PI Supports to.
    if you dont have third party adapter we do have other alternative , refer below blog
    /people/daniel.graversen/blog/2008/12/11/sftp-with-pi-the-openssh-way
    Regards,
    Raj

  • Making the connection

    Hi,
    in this class,
    http://cid-17ec75244bac022f.office.live.com/embedicon.aspx/for^_sharing/SimpleSql.java
    I am not sure if it's making the connection properly.
    I'm making use of it in a Jdev project
    regards,
    Huamin

    user12233770 wrote:
    thanks
    in the class, it's referring to one datasource like
    javax.sql.DataSource ds
    = (javax.sql.DataSource) ctx.lookup("examples-dataSource-demoXAPool");
    How can we locate to the source amid WLS?Hmm. Are you trying to say: "How do you configure a datasource in Weblogic Server"?
    Really, if you want help, make the effort to ask a proper question, WITHOUT abbreviations :s

  • SFTP connection issue with Dreamweaver 2014

    I have a very weird SFTP connection issue with Dreamweaver CC (2014). I am on a Mac running 10.9.4 and have no problem connecting to my server through SFTP with Dreamweaver CS 6. However, using the exact same settings on CC (2014), I get the following error: "An FTP error occurred - cannot make connection to host. Your login or password is incorrect. Please check your connection information".
    I am truly at a loss here. Command line connection works without problems.
    Any thoughts?

    Hi there,
    Try after rebooting your system or in a different user account on MAC.
    Is there any limit with number of login sessions with your SFTP?
    Could you check with Filezila or similar FTP client and connect to your site, see if you get any error there?
    Thanks.

  • My niece gave me her old ipod touch 8GB and her passlock code.  It is stuck in the "connect to itunes" mode and won't let me even access the slide to unlock.  How to I fix??

    my niece gave me her old ipod touch 8GB and her passlock code.  It is stuck in the "connect to itunes" mode and won't let me even access the slide to unlock.  How do I fix??

    You will need to Restore it as a New Device...
    Restore...
    1: Connect the device to your computer and open iTunes.
    2: If the device appears in iTunes, select and click Restore on the Summary pane.
    3: If the device doesn't appear in iTunes, try using the steps in this article to force the device into recovery mode.
    Backing up, Updating and Restoring
    http://support.apple.com/kb/HT1414

Maybe you are looking for

  • Message From Web Page

    Hi, I am working on Web Analysis 11.1.1.3. One of mine report has service btton like "Sent to Excel". This button is working while running the report in Web Analysis Studio but not in HTML. In HTML view showing message like "This Service button is no

  • Change Data Table column header color

    How do I change the background color displayed in data table column headers?

  • ORABPEL-30017 Invalid task definition.

    Hi All, We are on 10.1.3.3. BPEL and we see below error in log frequently especially when server is started. Some times even this issue brought server down . We have multiple human tasks in our bpels and each flow also has one common task called Admi

  • Error Code (0xc0150004) seeking to us Ps CC

    Hi Receive error code (0xc0150004) when seeking to open a .jpg file with Photoshop CC.  When using the 'file open with' option. I can open the some .jpg file with Ps Elements 11. With Ps CC open and running from its desktop icon I can use the 'file o

  • Lightroom Sharpening Tutorial

    I just went carefully through the following sharpening tutorial from Martin Evening. I highly recommend downloading the image and going throught the steps. I now finally understand what all of the sliders do, i.e. amount, radius, detail, etc. This tu