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)?


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)

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.