Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I'm new to cryptogragraphy and have no idea how to do this. So i get a public key from a Putty session and it looks like this:


by searching the Internet I found following Thread in which the same format appears, so I know that the first hex value is the exponent and the second value is the modulus. But i cound't find anything on how to use the two to get a simple public key.

My Question is: How do I convert the key to a standard openssh fromat ergo base64?

hope someone can help.

share|improve this question

migrated from Sep 21 '11 at 15:25

This question came from our site for professional and enthusiast programmers.

you'll get good answers if you ask this question in the associated forum – Mansuro Sep 21 '11 at 10:05
thx i was wondering – almightyBob Sep 21 '11 at 11:13
@Mansuro Actually, this question is not really cryptography-related, it is just conversion between two number formats. – Paŭlo Ebermann Sep 21 '11 at 11:56
thanks for the help, yeah it isn't actually a cryptography question more a conversion problem – almightyBob Sep 21 '11 at 12:19

The usual way to convert keys between different formats is to use the key generation programs of the corresponding programs, which usually also have some conversion option.

In your case, a Putty key can be converted to other formats by usage of the PuttyGen program.

The documentation explains how to do this in a GUI way (you need the *Public key for pasting into authorized_keys file* format).

Using PuTTY ssh keys with OpenSSH on Ubuntu seems to show a command line way to do this, too:

puttygen /path/to/puttykey.ppk -L > ~/.ssh/

(I did not try this, and one of the comments there says it does not work this way - have a look at the documentation.)

share|improve this answer
Thanks that's defninitly a step in the right direction. Sadly though Puttygen doesn't accept my key. I always get the error "Counldn't load private key(is not private key), what is true because it is a public key. I can't find anyplace where i can load a public key only a private key – almightyBob Sep 21 '11 at 13:33

This is a two stage process. First convert your hex into byte arrays. Second convert your byte arrays into Base64 strings. You will probably find library functions to help with Base64, and converters are common on the web. I assume you can do hex to byte conversions or a library function may be available. Be careful that the library function is not just converting the ASCII characters to hex, i.e that your "0x23" string is converted to { 0x23 } and not { 0x32, 0x33 }.

share|improve this answer
I want to have a single value after the conversion its not a question of simple hex to base64 but from WinSCP pk to Openssh pk – almightyBob Sep 21 '11 at 12:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .