How do I make a PGP key? I'd like to have it for signing PPA uploads and such.


3 Answers 3


Generating a PGP Key

Here is a GUI way to generate a new PGP key.

  1. Open the Passwords and Keys (Seahorse) application

    This screen will appear.

    Passwords and Keys screenshot

  2. Either go to FileNew in the global menu or hit Ctrl + N

  3. In the Create New ... window select PGP Key and hit Continue

    Create New ... screenshot

  4. Enter your full name and your email address, the comment is optional

    New PGP key screenshot

  5. Enter a strong password which you'll remember

    Passphrase for New PGP Key screenshot

  6. Wait for the Generating key dialog to finish (this may take a while)

  7. You're done!

You can find your key in the Passwords and Keys application's My Personal Keys tab.

My Personal Keys screenshot

Uploading your key to Launchpad

Uploading your key to Launchpad is just a few clicks.

  1. Go to Launchpad.net and log in

  2. On your profile page click on the yellow edit button (a round button with a grey pencil icon) next to OpenPGP keys

    Note: The URL to that page looks like this https://launchpad.net/~yourusername

    OpenPGP keys on LP

  3. Open the application Passwords and Keys (Seahorse)

  4. Navigate to the My Personal Keys tab

  5. Select your key and go to RemoteSync and Publish Keys in the global menu

  6. Hit Sync

    enter image description here

    Note: The Sync button may be grayed out if no sync server is selected. In that case:

    • Hit the Key Servers button

      enter image description here

    • Select the hkp://keyserver.ubuntu.com:XXXXX key server from the Publish keys to list and hit close

      enter image description here

  7. Double click your PGP Key from the list on the My Personal Keys tab

  8. In the key window that just appeared navigate to the Details tab, select the Fingerprint with your mouse and hit Ctrl + C

    enter image description here

  9. Paste the just copied fingerprint into the Fingerprint text field on the Change your OpenPGP keys page on Launchpad and hit Import Key

    enter image description here

  10. You're done!

  • Might I add that if no password is given, it will err, but give an almost-useless error?
    – nanofarad
    Commented Aug 20, 2012 at 15:01
  • 8
    At step 9, it can take 10 minutes before the Ubuntu server knows your key. Commented Aug 7, 2013 at 5:34
  • It just starts with "here is a GUI" But where can I get this GUI, how can I install this GUI? For example: sudo apt install openpgpgui or do I need to add a new repository?
    – Alex WLBI
    Commented Jun 4, 2016 at 8:43
  • @AlexWLBI It says clearly "Open the Passwords and Keys (Seahorse) application"
    – Jakuje
    Commented Jun 19, 2016 at 18:31
  • after importing, I got a pop up message saying, an email has been sent with an encrypted key XXXXXXXXXXXXXX. I received the mail too. But how do I decrypt the message sent to me with the key XXXXXXXX provided?
    – sphoenix
    Commented Sep 28, 2018 at 19:44

Creating your OpenPGP keys with gpg

Step 1: Open a terminal and type:

gpg --gen-key

Step 2: GPG will now ask you a number of questions about the type of key you want to generate. follow the steps below to select the default option each time.

Step 3: Check that your key has been generated by typing gpg --list-keys and, if successful.

pub 1024D/12345678 -> this is the important number

Step 4: Launchpad doesn't store your key directly, so you need to export your public key to a key server, such as keyserver.ubuntu.com:

gpg --keyserver keyserver.ubuntu.com --send-keys 12345678

Replace 12345678 with the pub id you noted in step 3.

If successful, GPG will display a message similar to:

gpg: sending key 12345678 to hkp server keyserver.ubuntu.com

Importing your key into Launchpad with gpg

Step 1: Launchpad identifies your OpenPGP key by its fingerprint. In your terminal, you can ask GPG for your key's fingerprint by typing:

gpg --fingerprint

GPG will display a message similar to:

  Key fingerprint = `0464 39CD 2486 190A 2C5A  0739 0E68 04DC 16E7 CB72`

copy only the numeric fingerprint: 0464 39CD 2486 190A 2C5A 0739 0E68 04DC 16E7 CB72.

Step 2: Visit your OpenPGP

Step 3: Paste the fingerprint that you copied in step 1 into the Fingerprint text-box, then click the Import Key button. Launchpad will use the fingerprint to check the Ubuntu key server for your key and, if successful, send you an encrypted email asking you to confirm the key import.

Note : this is a brief ... from launchpad process..... both process take a while so just take your time...

  • 3
    Step 1 may take a while if you do not have a hardware random number generator. Do not use methods which promise to speed this up because it makes your keys weaker.
    – Lekensteyn
    Commented Nov 8, 2011 at 18:06
  • 1
    If the gpg command fails to send the key to the keyserver, try pasting the result of "gpg --export -a IMPORTANT_NUMBER" to keyserver.ubuntu.com.
    – igordcard
    Commented Mar 26, 2014 at 18:27
  • Prefix the first command with sudo if you do not work as root. Otherwise gpg will not be able to store the key, and therefore key creation will fail.
    – BurninLeo
    Commented Apr 21, 2016 at 6:31
  • browse giphy while Step 2 is generating randomness. Commented Jun 22, 2017 at 20:24
  • It may take keyserver.ubuntu.com 10 minutes to update. To verify, you can go to keyserver.ubuntu.com and search by the name or email that was used to generate the key.
    – wisbucky
    Commented Aug 1, 2017 at 21:52

On some systems such as lubuntu where the password and keys (seahorse) app is not available, a good and simple way to make PGP key is using gpa (GNU privacy assistant). It is a graphical frontend for gpg. This method also apply to others ubuntu derivatives.

  1. install gpa

sudo apt install gpg gpa

2.launch gpa from your applications menu

enter image description here

3.Hit the Keys menu then select New Key . you are presented with a new window

enter image description here

4.Type in your full Name, click forward, then type in your geniune email address.press forward. Now select the option to do a backup later.

  1. enter a passphrase (could be a word or phrase) to protect your PGP key

  2. Now you have successfully created a pgp key. It is actually a pair, consisting of both your private key and public key

  3. To use PGP in ur correspondence, for example for exchanging email securely you need to give the other party your public key. So lets first export your public key then you can send it to them. To export, open gpa and select your key. Now hit Keys menu followed by export keys. Give your public key a name and save it

tip: to ensure you exported the public key, open it with a text editor and check if there is a starting line


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .