Automated Batch Subkey Creation

Hauke Laging mailinglisten at
Sat Sep 13 15:19:36 CEST 2014

Am Sa 13.09.2014, 16:53:09 schrieb Sam M:
> Werner,
> I'm not a programmer, so I don't know much about source code. But I
> had downloaded the code for GPA. And to try and find an example, I
> did a grep on the option command-fd. I didn''t find anything.
> I would be grateful if you could point out the example you're
> referring to, or just give me one.

Try this (shell code, bash):

echo addkey$'\n'8$'\n'e$'\n'q$'\n'${subkeylength}$'\n'"$expire_period"\
$'\n'save$'\n' | 
LC_ALL= LANGUAGE=en gpg --expert --batch --display-charset utf-8 \
--passphrase "$PASSPHRASE" --command-fd 0 --edit-key $short_id

Adapt the input after "8" to the capability flags you need.

I use that in my (German) script for creating offline mainkeys:

Crypto für alle:
OpenPGP: 7D82 FB9F D25A 2CE4 5241 6C37 BF4B 8EEF 1A57 1DF5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: </pipermail/attachments/20140913/59b163a1/attachment.sig>

More information about the Gnupg-users mailing list