Puttygen patch for entering passphrases from command line

If you want to use Putty's key generation program Puttygen from a command line, you can use the Unix version. However, as specified in the documentation, it is still required  to enter password manually. That behaviour can not be circumvented by redirection either. A small patch (attached) is developed to introduce the option -N for specifying a new passphrase from the command line:

C:\Program  Files (x86)\ICW\bin>puttygen --help
PuTTYgen unidentified build, Mar  2 2011 22:53:04
Usage: puttygen ( keyfile | -t type  ) 
                  
                 
  -t    specify key type when generating (rsa, dsa, rsa1)
  -b    specify number of bits when generating key
  -C    change or specify key comment
  -P    change key passphrase
  -q    quiet: do not display progress bar
  -N    new passphrase 
-O specify output type: private output PuTTY private key format private-openssh export OpenSSH private key private-sshcom export ssh.com private key public standard / ssh.com public key public-openssh OpenSSH public key fingerprint output the key fingerprint -o specify output file -l equivalent to `-O fingerprint' -L equivalent to `-O public-openssh' -p equivalent to `-O public'

NB! the patch allows passphrases without spaces only.

AttachmentSize
File cmdgen.option-N.patch1.73 KB