Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Putty Key Generator Command Line interface?

Is it possible to use Putty Key Generator via command line interface? I cannot find any documentation.

Any pointers?

Btw, I only want to generate a openssh formatted key pair on a windows machine.

like image 269
Julien Pierre Avatar asked Dec 12 '22 14:12

Julien Pierre


2 Answers

Reading the source code it appears that there is a command line interface

in the main

if (argc > 0) {
if (!strcmp(argv[0], "-pgpfp")) {
    pgp_fingerprints();
    exit(1);
} else {
    /*
     * Assume the first argument to be a private key file, and
     * attempt to load it.
     */
    cmdline_keyfile = argv[0];
}
}

you have a choice

  • -pgpfp

Which outputs a message:

void pgp_fingerprints(void)
{
    fputs("These are the fingerprints of the PuTTY PGP Master Keys. They can\n"
      "be used to establish a trust path from this executable to another\n"
      "one. See the manual for more information.\n"
      "(Note: these fingerprints have nothing to do with SSH!)\n"
      "\n"
      "PuTTY Master Key (RSA), 1024-bit:\n"
      "  " PGP_RSA_MASTER_KEY_FP "\n"
      "PuTTY Master Key (DSA), 1024-bit:\n"
      "  " PGP_DSA_MASTER_KEY_FP "\n", stdout);
}
  • a keyfilename which is later used to

    if (cmdline_keyfile) load_key_file(hwnd, state, filename_from_str(cmdline_keyfile), 0); return 1;`

My suggestion is follow the code and see what's what.

like image 193
Preet Sangha Avatar answered Feb 18 '23 22:02

Preet Sangha


You're probably out of luck: puttygen (for good reason) doesn't really have a solid command line interface.

For what you need ssh-keygen on Windows is probably what you'll need. It takes a bit of work but you might be able to extract it from the mSysGit install at http://code.google.com/p/msysgit/downloads/list and use that.

like image 26
Femi Avatar answered Feb 18 '23 21:02

Femi