Using --gen-key --batch doesn't seem to work anymore

Filias Heidt post at filias.name
Mon Jan 19 11:29:39 CET 2015


Hi List,

I have been using a Script which gets the key ID via
/usr/local/bin/gpg --list-keys root@ | grep -B1 'backup-key' | sed -n 's/pub.*\/\([:alnum:]*\)/\1/p' | cut -d' ' -f1

and if there is no key ID found, it tries to generate a key via
/usr/local/bin/gpg --gen-key --batch < /root/gpg_config 2>&1 | cut -d' ' -f3 | tail -n1

the gpg_config file is looking like this:

Key-Type: default
Subkey-Type: default
Name-Real: $hostname
Name-Comment: backup-key for $hostname
Name-Email: root@$hostname
Expire-Date: 0
Passphrase: secret
%commit

Somehow, since the last update, the key Generation does not work anymore. If I try to execute that exact step on the command line, I get:
# gpg -vv --gen-key --batch < gpg_config
gpg: agent_genkey failed: Operation cancelled
gpg: key generation failed: Operation cancelled

I put a line in the .gnupg/gpg-agent.conf, because I thought it might have to do something with the Agent:
allow-loopback-pinentry

I must say, my experiences with gnupg are very limited, so I can simply miss something. Is there an obvious reason why this fails?
Some help would be greatly appreciated.

Greetings,
Filias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: </pipermail/attachments/20150119/e6a22d39/attachment.sig>


More information about the Gnupg-users mailing list