How to show (for copy&paste) a secret GPG/PGP key without creating a file

0

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

Chaos_99

Posted 2013-08-13T13:16:17.057

Reputation: 681

Answers

1

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:

-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: GnuPG v1.4.13 (Darwin)
Comment: GPGTools - http://gpgtools.org

[snip]

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

Jens Erat

Posted 2013-08-13T13:16:17.057

Reputation: 14 141

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 – 2013-08-14T09:34:48.330