Summary: When trying to generate a key using the batch file mode, the
"Key-Type: default" option beraks the operation.
As part of some testing, I'm generating a temporary key, using a batch
file to pass some parameters. Use this little shell script as a
reproducer:
===========================================================
#!/bin/sh
set -eu
temp_dir="$(mktemp --directory --tmpdir "reprod.$$.XXXXX")"
trap "cd / ; rm -rf \"$temp_dir\"" EXIT
gpg_home="$temp_dir/gpg_home"
mkdir -m700 "$gpg_home"
batch_file="$temp_dir/batch"
cat <<__EOS__ >"$batch_file"
Key-Type: default
Subkey-Type: default
Name-Real: John Doe
Name-Email: john.doe@example.com
Expire-Date: 0
%no-protection
%commit
__EOS__
gpg --homedir "$gpg_home" --batch --generate-key "$batch_file"
gpg --homedir "$gpg_home" --with-colons --list-keys
===========================================================
In Debian 12 (gpg 2.2.40-1.1), and expected, output is (modulo
timestamps and various random bits):
| gpg: keybox '/tmp/reprod.1908235.T8HfC/gpg_home/pubring.kbx' created
| gpg: /tmp/reprod.1908235.T8HfC/gpg_home/trustdb.gpg: trustdb created
(...)
| tru:o:1:1744699266:1:3:1:5
| pub:u:3072:1:5568831507F12921:1744699264:::u:::escaESCA::::::23::0:
| fpr:::::::::41F2D907E7F11CD5825719045568831507F12921:
| uid:u::::1744699264::454A9C7753721D33C846A7FFEDB690FD548BCE5C::John Doe <john.doe@example.com>::::::::::0:
| sub:u:3072:1:2B5308B1ED9F66BA:1744699264::::::esa::::::23:
| fpr:::::::::0E7033D83012E06FE36CB9762B5308B1ED9F66BA:
Since the advent of gpg 2.4.7-14, gpg --generate-key fails:
| gpg: keybox '/tmp/reprod.1908493.etLXj/gpg_home/pubring.kbx' created
| gpg: key generation failed: Unknown elliptic curve
Not sure whether this is and intended change, at least it took
me some hours.
The workaround is to make the key type explicit, so