PHP Frontend

John Clizbe John at
Tue Jan 20 12:14:33 CET 2009

zim2901 wrote:
> Hi,
> I want to create a frontend to generate gpg public keys in PHP. There is a
> function called shell_exec. This function, execute a command via shell. But
> you can only pass one command to the funktion. 
> If I start cmd.exe and take the command "gpg --gen-key", gpg opens a dialog.
> My problem is that gpg only works with this dialog. It gives a question and
> anticipate a responce. So I tried to pipe the necessary informations with a
> txt.- file, but it doesn't work!
> My question is, if it is possible to generate keys without do that dialog?
> In an other forum, sombody explains that this is not possible, because of
> secureness... If that is true, my whole projekt stops!
> Has anybody an idea?

See the section "Unattended key generation" in the file DETAILS in the doc
directory of the source code distribution.

[...]From DETAILS...
Here is an example:
$ cat >foo <<EOF
     %echo Generating a standard key
     Key-Type: DSA
     Key-Length: 1024
     Subkey-Type: ELG-E
     Subkey-Length: 1024
     Name-Real: Joe Tester
     Name-Comment: with stupid passphrase
     Name-Email: joe at
     Expire-Date: 0
     Passphrase: abc
     %secring foo.sec
     # Do a commit here, so that we can later print "done" :-)
     %echo done
$ gpg --batch --gen-key foo
$ gpg --no-default-keyring --secret-keyring ./foo.sec \
				  --keyring ./ --list-secret-keys
sec  1024D/915A878D 2000-03-09 Joe Tester (with stupid passphrase) <joe at>
ssb  1024g/8F70E2C0 2000-03-09

John P. Clizbe                      Inet:John (a)
You can't spell fiasco without SCO. hkp://  or
     mailto:pgp-public-keys at

Q:"Just how do the residents of Haiku, Hawai'i hold conversations?"
A:"An odd melody / island voices on the winds / surplus of vowels"

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

More information about the Gnupg-users mailing list