Macchiato
Macchiato

Reputation: 815

Android SSH : Convert PuttyGen PPK to Dropbear Key

I am developing an Android application that utilizes RSYNC over SSH to sync up with a network folder. but im having problem with Key provided by puttygen ssh: string too long. I figured out that the ssh client installed in my device is a dropbear ssh client. For this to work, I have to convert PuttyGen PPK to a dropbear key.

Is there's a way to convert PuttyGen PPK to Dropbear Key?

Can I convert it using my ubuntu machine? so that i will just copy the generated key to my android device?

Upvotes: 3

Views: 10166

Answers (3)

Carlos Bribiescas
Carlos Bribiescas

Reputation: 4427

Actually, it is installed by default, just in a weird place.

https://bugs.launchpad.net/ubuntu/+source/dropbear/+bug/1009868

Upvotes: 0

Adambean
Adambean

Reputation: 1161

Here is how I converted my PuTTY keys to work in SSHDroid:

  1. Open your PPK file in PuTTYgen
  2. Clear the passphrase fields as dropbearconvert doesn't support encrypted keys
  3. Conversions -> Export OpenSSH -> Save as YourKey.id_dsa or YourKey.id_rsa depending on if your keys are DSA or RSA
  4. Install SSHDroid and start the server using password authentication
  5. Open an SSH session to your Android device and login using the password you set
  6. Transfer your YourKey.id_?sa file to your Android device (any way you like)
  7. CD to where your uploaded OpenSSH key file is
  8. Enter command: dropbearconvert openssh dropbear YourKey.id_?sa YourKey.dropbear
  9. Import this file into SSHDroid's key management
  10. Switch off password authentication!

The resulting file was one I could import into SSHDroid. If you want to keep the converted file for future use put it inside an encrypted 7z or RAR as this dropbear key pair file is not protected. You can delete the file once it's imported into SSHDroid anyway.

Upvotes: 1

Jens
Jens

Reputation: 17087

Download the dropbear source to your machine, build it, and you should have access to dropbearconvert which can convert keys formatted for OpenSSH to the dropbear format.

Just doing a apt-get install dropbear will not install the dropbearconvert tool.

Edit: Oh, and you can convert your PPK file to OpenSSH using puttygen.exe.

File menu -> Load your PPK file. Conversions menu -> Export as OpenSSH file.

Upvotes: 3

Related Questions