Export private key

Andrew Gallagher andrewg at andrewg.com
Wed Jan 6 16:47:54 CET 2021


On 06/01/2021 14:14, Dino Edwards via Gnupg-users wrote:
> Hello all,
> 
> In the past I used to be able to export a private key using the 
> following command:
> 
> /usr/bin/gpg --homedir /opt/.gnupg/ --export-secret-key -a "SOMEKEYID" > 
> /opt /tmp/private.key
> 
> Something changed in the code and it now prompts me for the key password 
> before it proceeds. I see the value in this, however this is problematic 
> when I’m trying to automate the export to use in an application.
> 
> What is the correct way to pass the key password in the command line in 
> order to export the private key without getting the password prompt?

You could try:

     gpg --passphrase-fd 3 ...more-options... 3<somefile

where somefile is a file containing the passphrase, or a fifo with a 
coprocess writing the passphrase to it...

-- 
Andrew Gallagher

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20210106/01419578/attachment.sig>


More information about the Gnupg-users mailing list