Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:

0x23,0xa69e43f72f1d8f07a6baae6ea0b0ce81cbe949345a0a5e307ae89e9cf58b20a17571af39e951faf61c45ef2ca9e21897eb9bc226473783ed9c3f6e30c4a84fa625373af96f41f8d9670484b52a33072eae6bb5433a2f00c672c20d7a03636a1b26af15b0d3ed376b9699e8653caa198637be88282333e8038bed63b9a2c6d179

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. http://winscp.net/forum/viewtopic.php?t=5850

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 stackoverflow.com 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 crypto.stackexchange.com –  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

2 Answers 2

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/id_rsa.pub

(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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.