Take the 2-minute tour ×

I need to access my secret GPG/PGP key to copy/paste it into another application.

How do I show my secret key without generating too much traces of it?

I only know of the export command to gpg (or the export function in several GUI-GPG tools), but this would always generate a file. A file on the filesystem needs to be securely erased afterwards, may get picked up by synchronization, backup or mirroring tools etc.

So is there a way to show it in a dialog window (no traces except RAM/swapfile) or at least only to the console window (will leave trace in console history)?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Both --export and --export-secret-keys write to stdout (which you can pipe wherever you want) if no file is given.

gpg --export-secret-keys -a [KEYID]

Will output:

Version: GnuPG v1.4.13 (Darwin)
Comment: GPGTools - http://gpgtools.org


(ommit the -a option if you do not want ascii armored output)

share|improve this answer
Thanks! I was to stupid to actually try the --export option on the command line after all the GUI tools only offered file output. –  Chaos_99 Aug 14 '13 at 9:34
add comment

Your Answer


