Skip to content

Import & Export Key Pair

GpgFrontend gives you several ways to import keys (bring them in) and export keys (save or share them). You’ll usually do this for two reasons: to share your public key with someone, or to back up your own keys. This page covers each method.

You can import a public or private key in a few ways.

  1. Click the Import button in the toolbar, or open Keys > Import Key.

    The main window with the Import button in the toolbar highlighted

  2. Choose where the key comes from. The choices are explained below.

Choice Where you find it What it does
File Both windows Pick a public or private key file.
Editor Main window only Imports the key from the text in the current editor tab. Paste the key into a tab first.
Clipboard Both windows Imports the key text you copied to your clipboard. In the KeyPair Management window you can also press Ctrl+V.
Key Package KeyPair Management only Imports keys from a protected backup file. See KeyPackage.
Key Server Both windows Search for the person, and double-click a result to import that key. Public keys only. See Key Server Operations.

A few more details:

  • File: the file window shows Keyring files only: files that end in .asc or .gpg. A key file can be at most 16 MB. In the KeyPair Management window, File > Open does the same. The shortcut is Ctrl+O.
  • Key Server: a key server is a website that stores public keys. If the key server module is turned off, Key Server is not in the menu. See Module Controller.
  1. Drag one or more key files onto the Key ToolBox, or onto the KeyPair Management window. You can also drag key text, for example from a web page.

  2. GpgFrontend asks: “You’ve dropped something on the key list. GpgFrontend will now try to import key(s).” Click OK.

    If you do not want this question again, untick Ask before importing keys next time. before you click OK.

A dropped file that is bigger than 16 MB, or that GpgFrontend cannot read, is skipped. A message lists the files that were not imported.

After an import, the Key Import Details window opens. At the top it says how it went:

  • Import Successful: new keys or new parts of keys were added.
  • Nothing to Import: you already had all of these keys, unchanged.
  • Import Completed with Issues: some keys could not be imported.

Under Summary you see counts, such as Imported, Unchanged and Not Imported. Below that is a list of the keys, with their Name, Email, Status and Fingerprint. Click OK to close the window.

If GpgFrontend found no key at all, you only see the message “No keys found to import”.

Exporting saves a key so you can back it up or share it. GpgFrontend always exports in ASCII text, so the file works across different computers.

You can export your public key (safe to share) or your private key (keep this secret).

Your public key is safe to give to anyone. There are a few ways to export it.

  1. In the main window, click Manage Keys. The KeyPair Management window opens.
  2. Right-click the key, open Export and choose Export Public Key….
  3. Pick where to save the file.

To paste the key somewhere instead of saving a file, open Copy in the same right-click menu and choose Copy Public Key Block. See Manage Your Keys.

Right-click a key in the Key ToolBox and choose Append Public Key to Editor. This adds the public key to the end of the text in the editor. You can copy it from there.

  1. Open the key’s Key Details window and go to the Operations tab. See Key Pair Details.

  2. Click Export Public Key.

    The Operations tab with the Export Public Key button highlighted

  3. Pick where to save the file.

To export the public keys of several key pairs together:

  1. In the KeyPair Management window, tick the box beside each key.
  2. Open Key > Export Key and choose Export To Clipboard. The Export Key button in the toolbar has the same menu.

The public keys are now on your clipboard. Paste them into any app or file.

If you tick no key, Export To Clipboard uses the rows you selected instead.

To save the ticked keys to a file instead, choose Export As Key Package in the same menu. This makes a protected file, a KeyPackage. At first it holds only the public keys. To add the private keys too, tick Include private keys in the window that opens. That window has more options, such as the package name and a PIN. See KeyPackage for all of them.

Two keys ticked in KeyPair Management, with the Export Key button highlighted

SSH is a common way to log in to another computer. Export As OpenSSH saves one key in the format an SSH server expects, so you can log in with your OpenPGP key. You need a key that can do Authentication (it has A in its usage).

In the KeyPair Management window, right-click the key, open Export and choose Export As OpenSSH. It is also under Key > Export Key.

GnuPG only This needs the GnuPG engine. With rPGP the item is hidden.

The quickest way is to right-click the key in the KeyPair Management window, open Export and choose Export Private Key….

You can also export from the key’s Key Details window:

  1. Go to the Operations tab.

  2. Click Export Private Key and pick one of the two choices below.

    The Operations tab with the Export Private Key button highlighted

  3. A warning window opens. Read it, then click OK.

  4. Choose where to save the file.

  5. An Export Successful message says where the file was saved.

Which warning you see depends on what you export:

  • Exporting Private Key: for Export Full Secret Key, and for Export Private Key… in the KeyPair Management window. It reminds you that anyone with the file can pretend to be you.
  • Exporting Short Private Key: for Export Shortest Secret Key. It also says that the file keeps only the latest self-signatures (the signatures your key made on its own UIDs).

To stop, click Cancel. Nothing is saved.

An exported private key file also holds the matching public key. A private key is of no use without it.

The Export Private Key button offers two choices:

Export Full Secret Key

Includes all key data, plus the user IDs and their signatures.

Export Shortest Secret Key

Includes only the key data, without the extra user ID signatures.

A backup is a copy of your keys that you keep somewhere else. If you lose your private key, everything encrypted to it may be gone for good. Nobody can recover a lost private key or passphrase for you, not even the people who make GpgFrontend.

Keep these things safe:

  • Your private keys. An exported private key file also holds the matching public key.
  • Your revocation certificates. A revocation certificate is a file that lets you cancel a key if it is lost or stolen. See Key Revocation.
  • Your passphrase. Remember it, or keep it somewhere safe. A backup of a key does not replace it.

Make a new backup each time you make, import or change a key.

Exporting keys one at a time is fine for sharing, but it is a poor way to make a backup. It is too easy to miss one.

You can save them all in one go:

  1. In the KeyPair Management window, open Operations > Bulk and choose Back Up All Private Keys…. This puts every private key in the key database into one protected file, called a KeyPackage.
  2. The same three-step window opens as for any KeyPackage, with all private keys already included.

A KeyPackage backup has two files, the package (.gfpack) and its key file (.key), plus the PIN you choose. You need all three to get your keys back, so keep the PIN safe too. To restore the keys, import the package as shown in Choose Where the Key Comes From. See KeyPackage for the details.

Keep the backup somewhere safe and offline, such as an encrypted drive. It holds your private keys, so treat it like the keys themselves. Keep your revocation certificates in the same place.

To copy a whole key database instead (all its keys, as files), see Back Up Your Key Databases.

Make a backup before you do something that can lose a key:

  • Before you delete a private key. Deleting cannot be undone.
  • Before you move a key onto a smart card. The private key leaves your computer. See Move an Existing Key to the Card.
  • Before you try a beta or a release candidate. These test versions use the same keys and settings as your normal GpgFrontend. See Version Numbering Policy.
  • Right after you make or import a key in GpgFrontend Lite (the Mac App Store edition). Lite keeps your keys inside its own storage, and removing the app or resetting your system can erase them. See Editions and Builds.