"-----BEGIN" missing?

FTP client for Android handsets.

"-----BEGIN" missing?

Postby dragondon » Fri Nov 14, 2014 8:47 am

Greetings all!

I'm trying to get AndFTP to work with my SSH key but it fails to read the file properly.

"Publickey authentication failed. java.io.IOException: Invalid PEM structure,'-----BEGIN...' missing"

and yet I use this exact same key with ConnectBot and VNC with no issues.

I am then presented with the normal username/login and I can't login, despite well knowing the username and password to the very system I am typing this on :)

Any suggestions?
dragondon
 
Posts: 2
Joined: Fri Nov 14, 2014 8:39 am

Re: "-----BEGIN" missing?

Postby support » Mon Nov 17, 2014 9:17 pm

Key must be in OpenSSH format.
support
 
Posts: 1010
Joined: Sun Apr 20, 2008 4:40 pm

Re: "-----BEGIN" missing?

Postby dragondon » Tue Nov 18, 2014 3:10 am

support wrote:Key must be in OpenSSH format.


Key was generated by OpenSSH. That "missing" part IS in the file.
dragondon
 
Posts: 2
Joined: Fri Nov 14, 2014 8:39 am

Re: "-----BEGIN" missing?

Postby support » Wed Nov 19, 2014 8:00 am

And when you open the key fiel, what do you see?
Does it look something like:
https://burnz.wordpress.com/2007/12/14/ ... ise-versa/
support
 
Posts: 1010
Joined: Sun Apr 20, 2008 4:40 pm

Re: "-----BEGIN" missing?

Postby sneakin » Sat Nov 22, 2014 1:12 am

I'm having this problem too wirh a key freshly copied from ConnectBot. The key has the "-----Begin" line. I've ried both RSA and DSA keys to noavail. OpenSSL was able to read the RSA key. I'm not sure which format I need to use. The DSA key looks like:

-----BEGIN PRIVATE KEY-----
MIIBSgIBADCCASsGByqGSM44BAEwggEeAoGBALkWczi61T7ZxEmv7JPfFLLd/fN
pLjWzRHPMJ0YoqCaay/RH3BVNtLbO+/D3zCnLe/5MqRz6Ffh0V1ZL1WcOond7Mx
49PHAhSgx3tHljuMAZtwa/KNLbSodinQlbfJ0CtD6RoHOdJT8KHQc795bkFybQm
BOBS6T0m1XHxubePODJAhUAvp60Q1iCw/1LDK9+m8f/9MQK5usCgYAwRyH2ciB1
TeZssqGph7tBIUWva6uvQFQsHlP6F9riXH7F8P0j9JmEEe/Y+Otjl2FRJ0qjb5h
bR1edHrhlTF3wb7kg2SwgjUWOTbUmf/e/EHc9q8BACHwxEAaba1cbTv3f5aaqPJ
Xi3quj9B2RErlqj6McogLKMkwzUGw6Vin6yQQWAhQta/D6F9sTtP9zKPWOPrGsx
5Lg+g==
-----END PRIVATE KEY-----
sneakin
 
Posts: 1
Joined: Sat Nov 22, 2014 1:05 am

Re: "-----BEGIN" missing?

Postby support » Sun Nov 23, 2014 3:02 pm

Any Carriage Return, Line feed on first line before the BEGIN?
support
 
Posts: 1010
Joined: Sun Apr 20, 2008 4:40 pm

Re: "-----BEGIN" missing?

Postby JackieButtons » Fri Feb 13, 2015 9:17 am

I am having similar problems. I have recently moved my ssh server over to key pair authentication and I cannot connect with Andftp. Because I don't have any linux clients I'm using puTTYgen to generate the key pair, and I'm using a passphrase. The public key as generated by puTTYygen has "--- BEGIN" at the beginning, and carriage returns after each line. If I import it into authorized_keys in this format of course it doesn't work. If I remove "---BEGIN" and all the carriage returns so it is one single line then it works.

It works for WINSCP and puTTY from Windows machines. It even works for another Android ftp app - TurboFTPClient - so it can't be a problem with the Android OS and encryption. But it doesn't work with AndFTP. Which is really annoying as I've forked out for the pro version in the hope that SCP (only available in pro) might work. It didn't.

This is the public key format as generated by puTTYGen:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20150213"
AAAAB3NzaC1yc2EAAAABJQAAAIBuIbhFCShivBgZTiairaxmW/jOT/RAP/pL+0jA
RvBXme/b6Hl96Mc2GhnLaCAh76kxehqJKegeH3PGqUGTdTB9jgMfL5VBz3UdDulV
vGK6VXpb4a75WYQDUALewCu9WHG7W9NWDqFVeQZ507y+xWJ3JPs2XyAAtXUoYBKg
3G+PtQ==
---- END SSH2 PUBLIC KEY ----

And this is how it has to be formatted in authorized_keys in order to work with other ssh clients ( this is one line with no carriage breaks, copying into this post have inserted them)

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBuIbhFCShivBgZTiairaxmW/jOT/RAP/pL+0jARvBXme/b6Hl96Mc2GhnLaCAh76kxehqJKegeH3PGqUGTdTB9jgMfL5VBz3UdDulVvGK6VXpb4a75WYQDUALewCu9WHG7W9NWDqFVeQZ507y+xWJ3JPs2XyAAtXUoYBKg3G+PtQ==

I like AndFTP for its ease of use and its interface. Any assistance would be appreciated, as the app is now useless to me.
JackieButtons
 
Posts: 3
Joined: Fri Feb 13, 2015 9:03 am

Re: "-----BEGIN" missing?

Postby JackieButtons » Fri Feb 13, 2015 11:28 am

Well I think I've found the answer. I've generated a new key pair from OpenSSH, and the public key cats into authoized_keys fine. The private key is another matter.

It contains the trailing "BEGIN" line but both puTTY and WINSCP don't accept keys in OpenSSH format. They only accept them in puTTYgen format. They advise you to use puTTYgen to convert them. But AndFTP doesn't accept keys in puTTYgen format.

I think the answer is to create the keys in OpenSSH, then convert the private key if you want to use it in puTTY or WINSCP, but keep it in the old format if you want to use it in AndFTP.

I shall try this out when I get home and report back.
JackieButtons
 
Posts: 3
Joined: Fri Feb 13, 2015 9:03 am

Re: "-----BEGIN" missing?

Postby JackieButtons » Fri Feb 13, 2015 11:54 am

Bingo. Tick "Legacy SSH" in "Expert/specific FTP settings" and it works.
JackieButtons
 
Posts: 3
Joined: Fri Feb 13, 2015 9:03 am


Return to AndFTP



Sitemap | Privacy Statement | Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc.
in the U.S. and other countries. All other company and/or product names are the property of their respective owners.