Forrest logo
back to the gpg tool

paperkey:tldr:14677

paperkey: Export a specific secret key and generate a text file with the secret data.
$ gpg --export-secret-key ${key} | paperkey --output ${path-to-secret_data-txt}
try on your machine

This command is using two command-line tools, gpg and paperkey, to export a secret key and save it in a text file.

Let's break down the command step by step:

  1. gpg: This is the command for GNU Privacy Guard (GPG), an encryption software that allows users to encrypt and sign files and communications. It is primarily used for secure communication and data protection.

  2. --export-secret-key: This option tells GPG to export the secret key specified by ${key}. A secret key is a part of asymmetric encryption and is used for decrypting messages encrypted with the corresponding public key.

  3. ${key}: This is a placeholder for the specific secret key you want to export. You would replace ${key} with the actual key ID or name you intend to export.

  4. |: This is a pipe symbol. It allows the output from the previous command to be redirected as input to the next command. In this case, it takes the exported secret key from gpg and pipes it to the next command.

  5. paperkey: This is another command-line tool used for extracting an encryption key from a GPG secret key, and converting it into a more human-readable format.

  6. --output: This option specifies the output location or path for the extracted secret key. You would replace ${path-to-secret_data-txt} with the actual file path and name you want to save the secret key as a text file.

In summary, this command exports a secret key using GPG and then uses paperkey to extract the key and save it as a human-readable text file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gpg tool