how can i generate a keypair without reading anwsers from stdin?

Florian Philipp lists at binarywings.net
Fri Aug 12 12:40:06 CEST 2011


Am 12.08.2011 08:41, schrieb 赵小强:
>  Hi there:
> I want to generate a keypair . But i dont want to type "gpg --gen-key"
> and then answer questions.
> I want to write all the answers in a file and then let gpg read the
> answer from the file in batch mode.
> What the format of the file should be? Any help?
> 

You can simply write the answers down like you would in an interactive
session with gpg. Then feed this file with `gpg --gen-key ... < file`

gpg just reads from standard input. There is no difference between a
user pressing return and a newline character in a text file.

If you want to generate multiple key from one file, try something like
`while gpg --gen-key ...; do true; done < file`

Hope this helps,
Florian Philipp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20110812/4524dfe5/attachment.pgp>


More information about the Gnupg-users mailing list