3 Replies Latest reply on Jun 4, 2009 9:33 AM by editcorp

    SFTP Secure FTP and PPK, invaid privatekey

    helloha33

      Hi,

           I am trying to connect via the CFFTP in CF8.

      I have the privatekey in "PuTTY-User-Key-File-2: ssh-rsa" SSH format

      Host Server MD5 fingerprint.

       

      But I keep getting this error message:

      Invaid privatekey:  [key name].ppk

       

      <cftry>
      <cfftp action="open" fingerprint="xx:xxx" connection="myconnection" key="c:\abc.ppk" passphrase="pass" secure="yes" server="sftp.server.com" port="22" stoponerror="yes" username="theUsername">
      <cfcatch type="any">
        <cfoutput>
        <cfdump var="#cfcatch#">
        </cfoutput>
      </cfcatch>
      </cftry>

       

       

      Thanks

        • 1. Re: SFTP Secure FTP and PPK, invaid privatekey
          editcorp Level 1

          I believe this has been mentioned before in a similar thread, but you'll need to have the private key file in

          OpenSSH format.  You can use a program named 'PuttyGen' to load the private key file, then "Export"

          that to a new file in OpenSSH format.  Once you do that, use the newly exported file as you're key file

          parameter and see how things go.

           

          Michael

          --

          • 2. Re: SFTP Secure FTP and PPK, invaid privatekey
            helloha33 Level 1

            Yes,

            The key was generated from WInscp Putty Key Generater, if you see the header in the post

            "ssh-rsa"

            there are 3 different kind of key that Winscp Generate

            I am afraid that CF8 only support certain key type from OpenSSH and they are not the same as WinSCP's Putty Key?

             

            SSH-1 (RSA)

            SSH-2 RSA

            and SSH-2 DSA

             

             

             

            this the the key in the header in the ppk file

            PuTTY-User-Key-File-2: ssh-rsa

             

             

            Thanks,

            • 3. Re: SFTP Secure FTP and PPK, invaid privatekey
              editcorp Level 1

              Very true, but in the version of PuttyGen that I use (release 0.60), there is a menu option called [Conversions], and under that is an option [Export OpenSSH key].  Load your private key file, then select that option and try the resulting file with your CFFTP call.  I actually did this earlier this week and it works just fine with CF8.  You can not use the file you would normally save with PuttyGen, you must use the one you "export".

               

              p.s.  Just to be clear, I generated a new key pair as "SSH-2 RSA", then exported it as an OpenSSH key file.  After installing the public key portion on the SFTP server, I used the exported (not the saved) private key file in the CFFTP tag, and all is working correctly.  If you try and use the saved SSH-2 RSA file, you'll get the "invaid privatekey" error.

               

              Regards,

              Michael

              --