Question

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.

Was it helpful?

Solution 2

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.

OTHER TIPS

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.

You could try and use the unix version of puttygen via cygwin.

There is also a writeup as to why puttygen doesn't support command line in Windows. With the window version you can only specify the keyfile for it to load initially.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top