Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: GnuPG: users

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

 

 

GnuPG users RSS feed   Index | Next | Previous | View Threaded


zxq_yx_007 at 163

Aug 11, 2011, 11:41 PM

Post #1 of 5 (370 views)
Permalink
how can i generate a keypair without reading anwsers from stdin?

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?


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


wk at gnupg

Aug 12, 2011, 3:40 AM

Post #2 of 5 (353 views)
Permalink
Re: how can i generate a keypair without reading anwsers from stdin? [In reply to]

On Fri, 12 Aug 2011 08:41, zxq_yx_007 [at] 163 said:

> 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?

See the chapter "Unattended GPG key generation" in the manual, for
example online at

<http://gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html>


Shalom-Salam,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


lists at binarywings

Aug 12, 2011, 3:40 AM

Post #3 of 5 (354 views)
Permalink
Re: how can i generate a keypair without reading anwsers from stdin? [In reply to]

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
Attachments: signature.asc (0.26 KB)


jerome at jeromebaum

Aug 12, 2011, 9:34 AM

Post #4 of 5 (356 views)
Permalink
Re: how can i generate a keypair without reading anwsers from stdin? [In reply to]

> 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`

I certainly think the batch solution is more appropriate. The batch
interfaces will be more consistent across different gpg versions,
while the numbers/letters you enter at the prompt can quickly change
if different algorithms are supported in a new version etc.

So stick with the batch and with-colons interfaces whenever you can.
They are also easier to script -- computer-readable and all that.

--
Jerome Baum

Hessenweg 222
48432 Rheine
GERMANY

tel +49-1578-8434336
email jerome [at] jeromebaum
web www.jeromebaum.com
--
Einigkeit und Recht und Modeerscheinung
--
PGP: A0E4 B2D4 94E6 20EE 85BA E45B 63E4 2BD8 C58C 753A
PGP: 2C23 EBFF DF1A 840D 2351 F5F5 F25B A03F 2152 36DA
--
http://five.sentenc.es

_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users


wk at gnupg

Aug 13, 2011, 2:04 AM

Post #5 of 5 (354 views)
Permalink
Re: how can i generate a keypair without reading anwsers from stdin? [In reply to]

On Fri, 12 Aug 2011 12:40, lists [at] binarywings said:

> 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`

*Don't do this* !

The interface presented there is for humans only and may change at any
time. In fact, it depends on certain options and has changed several
times in the past.

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

There is one: gpg reads directly from the TTY unless you use --batch.
This allows the use of readline features and to disable echo during
passphrase entry.

Please use a parameter file as described in the manual. This is a well
defined interface and the way to control key generation.


Salam-Shalom,

Werner

--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.


_______________________________________________
Gnupg-users mailing list
Gnupg-users [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-users

GnuPG users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.