How to convert a public key generated by PuTTY to RFC 4716 format

public-keyputtyssh-keys

I am using PuTTYgen in order to generate public and private key. My question is, how could I convert this files to RFC4716 format?

PuTTYgen allows me to save the public key under a general format, example: File Format: All Files(*.*) and the private key under the native PuTTY format. PuTTYgen also allows exporting the keys as OpenSSH or ssh.com.

Despite that, I can't find any option which allows me to convert the file to RFC 4716 format. Is anyone aware of any solution? My operating system is Windows.
I appreciate any help you can provide!

Best Answer

RFC 4716 format is what the "Save public key" command generates:

RFC 4716 specifies a standard format for storing SSH-2 public keys on disk. Some SSH servers (such as ssh.com's) require a public key in this format in order to accept authentication with the corresponding private key. (Others, such as OpenSSH, use a different format; see section 8.2.10.)

To save your public key in the SSH-2 standard format, press the ‘Save public key’ button in PuTTYgen. PuTTYgen will put up a dialog box asking you where to save the file. Select a directory, type in a file name, and press ‘Save’.


A public key in the RFC 4716 format looks like:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "foobar"
AAAAB3NzaC1yc2EAAAABJQAAAQBZ9s5nqsH6bwB1ljF3DHBRs05PpeWIZEYnYRF5
Ri4CTpUlZq2Ne/32qUUKgLTXpGrsbmASqdYLqow5U91slzb5Lg6zfkZsWz+CgAFV
YPQ5/ZbAZHKstvvES8L/RYJBCczSCuJiQbi60OpRryxP2lVQXbWeLrF/xYThW07p
VhyxxOeB1KocM7gfA6etI7GkQBppFuE/gW1c+efzx6GQNaacimm9k7gSdd+t2JZx
x6WmMmTHxDzCcGz4DCjpctG2AHFu6RcguvhX4G4Dk+Q53Hu1+9OvocJXrXxvPbdu
qU9YwfGHe6ZRXTpV/5XvSXvkIr3moKyXiCAzSD20yffEAXT7
---- END SSH2 PUBLIC KEY ----