encryptiongnugnupgprivate-key

How to Export Private / Secret ASC Key to Decrypt GPG Files


Background: My boss has tried exporting an ASC key to me with public and private parts but whenever I get the file the private part never loads up and it won't decrypt any files.

We have tried Exporting the ASC Key using:

How do you properly export a secret or private asc key to decrypt gpg files?


Solution

  • You can export the private key with the command-line tool from GPG. It works on the Windows-shell. Use the following command:

    gpg --export-secret-keys
    

    A normal export with --export will not include any private keys, therefore you have to use --export-secret-keys.

    Edit:

    To sum up the information given in my comments, this is the command that allows you to export a specific key with the ID 1234ABCD to the file secret.asc:

    gpg --export-secret-keys --armor 1234ABCD > secret.asc
    

    You can find the ID that you need using the following command. The ID is the second part of the second column:

    gpg --list-keys
    

    To Export just 1 specific secret key instead of all of them:

    gpg --export-secret-keys keyIDNumber > exportedKeyFilename.asc
    

    keyIDNumber is the number of the key id for the desired key you are trying to export.