gen-key non-interactively

David Shaw dshaw at jabberwocky.com
Thu Feb 8 17:08:36 CET 2007


On Thu, Feb 08, 2007 at 04:59:26AM -0500, Mark Pinto wrote:
> I'm wanting to pass all of the information that gpg needs to create a
> key (key size, type, expiration, userid, etc) initially and not have
> gpg keep pausing to ask the user.  I've read the man page, read gpg
> --help, googled, and I still cant figure out how to pass those things
> to gpg while using --gen-key.  Any help would be *greatly*
> appreciated.

Make a file that looks like this:

     %echo Generating a standard key
     Key-Type: DSA
     Key-Length: 1024
     Subkey-Type: ELG-E
     Subkey-Length: 1024
     Name-Real: Joe Tester
     Name-Email: joe at foo.bar
     Passphrase: abc
     %pubring foo.pub
     %secring foo.sec
     # Do a commit here, so that we can later print "done" :-)
     %commit
     %echo done

Then do:

    gpg --batch --gen-key /path/to/the/file/above

End result will be a public key in foo.pub and secret key in foo.sec.
See the DETAILS file (in the doc directory) for the various things you
can do.

David



More information about the Gnupg-users mailing list