Category: Launchpad


Backup and Restore gpg keys

Step 1: Backup your gpg key

First list your keys first

# gpg --list-keys

/root/.gnupg/pubring.gpg
————————
pub   1024D/EE6E8046 2009-02-20
uid                 Bill Till (My GPG key) <test@abc.com>
sub   2048g/AE3B1BD4 2009-02-20

Select the KeyID which belogs to you. In this case it is EE6E8046.

To backup your Public key give the following command:

#  gpg -ao mypub.key --export EE6E8046

This will create a file called “mypub.key”

To backup your Private key give the following command:

#  gpg -ao myprivate.key--export-secret-keys EE6E8046

This will create a file called “myprivate.key”

Now store these two files (mypub.key and mypub.key) on a floppy disk, CD or USB drive and put it away to some secure and safe place.

Step 2: Restore your gpg key

To restore the keys give the following commands:

# gpg --import myprivate.key

gpg: key EE6E8046: secret key imported
gpg: key EE6E8046: public key “Bill Till (My GPG key) <test@abc.com>” imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg:       secret keys read: 1
gpg:   secret keys imported: 1

# gpg --import mypub.key

gpg: key EE6E8046: “Bill Till (My GPG key) <test@abc.com>” not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

# gpg --list-keys

/root/.gnupg/pubring.gpg
————————
pub   1024D/EE6E8046 2009-02-20
uid                  Bill Till (My GPG key) <test@abc.com>
sub   2048g/AE3B1BD4 2009-02-20

Importing your new key in Launchpad

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:

pub   1024D/12345678 2007-01-26
      Key fingerprint = 0464 39CD 2486 190A 2C5A  0739 0E68 04DC 16E7 CB72
uid                  Matthew Revell (My test OpenPGP key) <test@matthewrevelltest.com>
sub   2048g/ABCDEF12 2007-01-26

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

Step 2: Visit your OpenPGP keys page

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.

Step 4: Check the email account that Launchpad has sent the confirmation email to. If your email client supports OpenPGP encryption, it will prompt you for the password you chose for the key when GPG generated it. Enter the password, then click the link to confirm that the key is yours.

{i} Quick tip: Launchpad encrypts the email, using your public key, so that it can be sure that the key is yours. If your email software doesn’t support OpenPGP encryption, copy the encrypted email’s contents, type gpg in your terminal, then paste the email contents into your terminal window.

Step 6: Back on the Launchpad website, click the Confirm button and Launchpad will complete the import of your OpenPGP key.

Launchpad will confirm that it has imported your key.

{i} Note: If you created the key id using an email address not registered in your Launchpad account, click confirm them to use it with Launchpad.

Introducing OpenPGP Key

An OpenPGP (also called GnuPrivacyGuard) key allows you to sign documents, such as emails or text files, using a digital key.

There are two parts to an OpenPGP key: one public that you share with the world and the other private, which you should guard closely. Both are standard text files that make up a digital signature.

Read more about OpenPGP keys

In Launchpad, you can use your OpenPGP key to identify yourself when using the bug tracker’s email interface, when uploading distribution packages and when signing a code of conduct.

Generating your key in Ubuntu

The easiest way to generate a new OpenPGP key in Ubuntu is to use the Passwords and Encryption Keys tool.

Step 1: Open Applications > Accessories > Passwords and Encryption Keys.

Step 2: Select File > New, select PGP Key and then follow the on-screen instructions.

Now you’ll see your new key listed in the Passwords and Encryption Keys tool.

Publishing your key

Your key is useful only if other people can verify items that you sign. By publishing your key to a keyservers, which acts as a directory of people’s public keys, you can make your public key available to anyone else.

Before you add your key to Launchpad, you need to push it to the Ubuntu keyserver.

Step 1: Open a terminal and type:

gpg --list-keys

Step 2: You’ll see a list of OpenPGP keys in your system, including the one you’ve just created, which look something like this:

pub 1024D/12345678 2007-01-26
uid Geoffrey Hayes (My OpenPGP key) <geoffrey@bungle.com>
sub 2048g/9ABCDEF1 2007-01-26

In the example above, 1024D/12345678 is the key’s public id. We need the second part, i.e. 12345678. Copy that part of your key’s public id.

Step 3: Enter:

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

Note: Replace 12345678 with the public key id you copied in the step 2.

If successful, GPG will display a message similar to:

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

Now you’re ready to import your new key into Launchpad!

Launchpad is a code hosting and software collaboration platform. Launchpad is open source

Register SSH key(https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair)
1) sudo apt-get install openssh-client
2) ssh-keygen -t rsa
3) When prompted, press Enter to accept the default file name for your key.
4) Next, enter then confirm a password to protect your SSH key. Your key pair is stored in ~/.ssh/ as id_rsa.pub (public key) and id_rsa (private key)
5) Then the public and private keys are available in the directory .ssh
6) open the id_rsa.pub in text editor. copy its contents to your clipboard
7) Visit your SSH keys page(https://launchpad.net/people/+me/+editsshkeys)
8) Paste your public key into the text box and then click the Import public key button to continue.