2

I'm using the following command to generate a gpg key

#!/bin/bash

cat > /tmp/gpg.txt << EOF
%echo Generating a basic OpenPGP key
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Subkey-Length: 1024
Name-Real: test
Name-Comment: test
Name-Email: [email protected]
Expire-Date: 0
Passphrase: test
%pubring test.pub
%secring test.sec
%commit
%echo done
EOF

gpg2 --armor --batch --gen-key /tmp/gpg.txt
rm -f /tmp/gpg.txt

It works partially. Only test.pub is created, and test.sec is empty.

Any ideas?

1
  • I'm having the same issue. Did you solve it in any way?
    – Polpetta
    Jun 12, 2019 at 14:04

1 Answer 1

2

Ok, so I've found a solution. According to ghe GnuPG documentation, the

%secring test.sec

is now deprecated:

%secring filename

    This option is a no-op for GnuPG 2.1 and later.

    See the previous subsection “Ephemeral home directories”.

This because they have changed the way private keys are stored, as described in this other documentation page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .