Step 2.a Make a keypair
-Make your keypair
-Open a terminal using ctrl + alt + t (on GNU/linux), or find it in your applications, and use the following code to create your keypair:
+Make your keypair
+Open a terminal using ctrl + alt + t (on GNU/linux), or find it in your applications, and use the following code to create your keypair:
We will use the command line in a terminal to create a keypair using the GnuPG program. A terminal should be installed on your GNU/Linux operating system, if you are using a macOS or Windows OS system, use the programs "Terminal" (macOS) or "PowerShell" (Windows) that were also used in section 1.
-# gpg --full-generate-key to start the process.
-# To answer what kind of key you would like to create, select the default option 1 RSA and RSA.
-# Enter the following keysize: 4096 for a strong key.
-# Choose the expiration date, we suggest 2y (2 years).
+# gpg --full-generate-key
to start the process.
# To answer what kind of key you would like to create, select the default option: 1 RSA and RSA.
+# Enter the following keysize: 4096
for a strong key.
# Choose the expiration date, we suggest 2y
(2 years).
Follow the prompts to continue setting up with your personal details.
--
Set your passphrase
+Set your passphrase
On the screen titled "Passphrase," pick a strong password! You can do it manually, or you can use the Diceware method. Doing it manually is faster but not as secure. Using Diceware takes longer and requires @@ -328,8 +325,6 @@ punctuation symbol. Never pick a password you've used elsewhere. Don't use any recognizable patterns, such as birthdays, telephone numbers, pets' names, song lyrics, quotes from books, and so on.
--
- GnuPG is not installed
-
-GPG is not installed. You can check if this is the case with the command gpg --version.
+GPG is not installed. You can check if this is the case with the command
gpg --version
. If GnuPG is not installed, it would bring up the following result on most GNU/Linux operating systems, or something like it: -Command 'gpg' not found, but can be installed with: - sudo apt install gnupg. Follow that command and install the program.
+Command 'gpg' not found, but can be installed with:
+ sudo apt install gnupg. Follow that command and install the program.
- I took too long to create my passphrase
- That's okay. It's important to think about your passphrase. When you're ready, just follow the steps from the beginning again to create your key.
- How can I see my key?
- -Use the following command to see all keys gpg --list-keys. Yours should be listed in there, and later, so will Edward's (section 3). If you want to see only your key, you can use gpg --list-key [your@email]. -You can also use gpg --list-secret-key to see your own private key. +Use the following command to see all keys:
- More resources
- For more information about this process, you can also refer to
Step 2.b Some important steps following creation
-Upload your key to a keyserver
+Upload your key to a keyserver
We will upload your key to a keyserver, so if someone wants to send you an encrypted message, they can download your public key from the Internet. There are multiple keyservers that you can select from the menu when you upload, but they are all copies of each other, so it doesn't matter which one you use. However, it sometimes takes a few hours for them to match each other when a new key is uploaded.
-# Copy your keyID gnupg --list-key [your@email] will list your public ("pub") key information, including your keyID, which is a unique list of numbers and letters. Copy this keyID, so you can use it in the following command.
-# Upload your key to a server: gpg --send-key [keyID]
- -
+# Copy your keyID:
+gpg --list-key [your@email]
will list your public ("pub") key information, including your keyID, which is a unique list of numbers and letters. Copy this keyID, so you can use it in the following command.# Upload your key to a server: +
-gpg --send-key [keyID]
Export your key to a file
+Export your key to a file
Use the following command to export your secret key so you can import it into your email client at the next step. To avoid getting your key compromised, store this in a safe place, and make sure that if it is transferred, it is done so in a trusted way. Exporting your keys can be done with the following commands:
-+
+ -$ gpg --export-secret-keys -a [keyID] > my_secret_key.asc
$ gpg --export -a [keyID] > my_public_key.asc -
- -Generate a revocation certificate
+Generate a revocation certificate
Just in case you lose your key, or it gets compromised, you want to generate a certificate and choose to save it in a safe place on your computer for now (please refer to step 6.C for how to best store your revocation cerficate safely). This step is essential for your email self-defense, as you'll learn more about in Section 5.
-# Copy your keyID gnupg --list-key [your@email] will list your public ("pub") key information, including your keyID, which is a unique list of numbers and letters. Copy this keyID, so you can use it in the following command.
-# Generate a revocation certificate: gpg --gen-revoke --output revoke.asc [keyID]
-# It will prompt you to give a reason for revocation, we recommend to use 1 "key has been compromised"
+# Copy your keyID:
+gpg --list-key [your@email]
will list your public ("pub") key information, including your keyID, which is a unique list of numbers and letters. Copy this keyID, so you can use it in the following command.# Generate a revocation certificate:
+gpg --gen-revoke --output revoke.asc [keyID]
# It will prompt you to give a reason for revocation, we recommend to use 1 = key has been compromised.
# You don't have to fill in a reason, but you can, then press enter for an empty line, and confirm your selection.
-
@@ -437,11 +428,11 @@ $ gpg --export -a [keyID] > my_public_key.asc@@ -544,7 +535,7 @@ alt="Step 3.A: Troubleshoot" />- My key doesn't seem to be working or I get a "permission denied."
@@ -471,20 +462,20 @@ your key as a file on your computer.Like every other file or folder, gpg keys are subject to permissions. If these are not set correctly, your system may not be accepting your keys. You can follow the next steps to check, and update to the right permissions.
-# Check your permissions: ls -l ~/.gnupg/*
+# Check your permissions:
ls -l ~/.gnupg/*
# Set permissions to read, write, execute for only yourself, no others. These are the recommended permissions for your folder.
+You can use the code:
-You can use the code chmod 700 ~/.gnupgchmod 700 ~/.gnupg
# Set permissions to read and write for yourself only, no others. These are the recommended permissions for the keys inside your folder.
+You can use the code:
-You can use the code: chmod 600 ~/.gnupg/*chmod 600 ~/.gnupg/*
If you have (for any reason) created your own folders inside ~/.gnupg, you must also additionally apply execute permissions to that folder. Folders require execution privileges to be opened. For more information on permissions, you can check out this detailed information guide.
Use the following commands to transfer your keys. To avoid getting your key compromised, store it in a safe place, and make sure that if it is transferred, it is done so in a trusted way. Importing and exporting a key can be done with the following commands:
-+
+$ gpg --export-secret-keys -a [keyID] > my_private_key.asc
$ gpg --export -a [keyID] > my_public_key.asc
$ gpg --import my_private_key.asc
$ gpg --import my_public_key.asc -Ensure that the keyID printed is the correct one, and if so, then go ahead and add ultimate trust for it:
-+
+ -$ gpg --edit-key [your@email] -
Because this is your key, you should choose ultimate. You shouldn't trust anyone else's key ultimately.
+Because this is your key, you should choose
ultimate
. You shouldn't trust anyone else's key ultimately.Refer to troubleshoot in step 2.B for more information on permissions. When transferring keys, your permissions may get mixed, and errors may be prompted. These are easily avoided when your folders and files have the right permissions
Once you have set up your email with encryption, you can start contributing to encrypted traffic on the Internet. First we'll get your email client to import your secret key, and we will also learn how to get other people's public keys from servers so you can send and receive encrypted email.
-# Open your email client and use "Tools" → OpenPGP Manager
-# Under "File" → Import Secret Key(s) From File
+# Open your email client and use "Tools" → OpenPGP Manager
+# Under "File" → Import Secret Key(s) From File
# Select the file you saved under the name [my_secret_key.asc] in step step 3.b when you exported your key
# Unlock with your passphrase
# You will receive a "OpenPGP keys successfully imported" window to confirm success
-# Go to "Edit" (in Icedove) or "Tools" (in Thunderbird) → "Account settings" → "End-To-End Encryption," and make sure your key is imported and select Treat this key as a Personal Key.
+# Go to "Edit" (in Icedove) or "Tools" (in Thunderbird) → "Account settings" → "End-To-End Encryption," and make sure your key is imported and select Treat this key as a Personal Key.
- I'm not sure the import worked correctly
- -Look for "Account settings" → "End-To-End Encryption" (Under "Edit" (in Icedove) or "Tools" (in Thunderbird)). Here you can see if your personal key associated with this email is found. If it is not, you can try again via the Add key option. Make sure you have the correct, active, secret key file. +Look for "Account settings" → "End-To-End Encryption" (Under "Edit" (in Icedove) or "Tools" (in Thunderbird)). Here you can see if your personal key associated with this email is found. If it is not, you can try again via the Add key option. Make sure you have the correct, active, secret key file.
- Don't see a solution to your problem? @@ -592,13 +583,13 @@ alt="Step 4.A Send key to Edward." />
- You may be trying to send an encrypted email to someone when you do not have their public key yet. Make sure you follow the steps above to import the key to your key manager. Open OpenPGP Key Manager to make sure the recipient is listed there.
- Unable to send message -
- You could get the following message when trying to send your encrypted email: "Unable to send this message with end-to-end encryption, because there are problems with the keys of the following recipients: edward-en@fsf.org." This usually means you imported the key with the "unaccepted (unverified) option." Go to the "key properties" of this key by right clicking on the key in the OpenPGP Key Manager, and select the option Yes, but I have not verified that this is the correct key in the "Acceptance" option at the bottom of this window. Resend the email. +
- You could get the following message when trying to send your encrypted email: "Unable to send this message with end-to-end encryption, because there are problems with the keys of the following recipients: edward-en@fsf.org." This usually means you imported the key with the "unaccepted (unverified) option." Go to the "key properties" of this key by right clicking on the key in the OpenPGP Key Manager, and select the option Yes, but I have not verified that this is the correct key in the "Acceptance" option at the bottom of this window. Resend the email.
- I can't find Edward's key
- Close the pop-ups that have appeared since you clicked Send. Make sure
@@ -776,7 +766,7 @@ pencil icon next to the lock icon so that it turns gold. If you sign a
message, GnuPG may ask you for your password before it sends the message,
because it needs to unlock your private key for signing.
-
In "Account Settings" → "End-To-End-Encryption" you can opt to add digital signature by default.
+In "Account Settings" → "End-To-End-Encryption" you can opt to add digital signature by default.
This is a special step that you won't have to do when corresponding with real people. In your email program's menu, go to "Tools" → "OpenPGP Key Manager." You should see your key in the list that pops up. Right click -on your key and select Send Public Keys by Email. This will create a new draft message, as if you had just hit the "Write" button, but in the attachment you will find your public keyfile.
+on your key and select Send Public Keys by Email. This will create a new draft message, as if you had just hit the "Write" button, but in the attachment you will find your public keyfile.Address the message to edward-en@fsf.org. Put at least one word (whatever you want) in the subject and body of the email. Don't send yet.
-We want Edward to be able to open the email with your keyfile, so we want this first special message to be unencrypted. Make sure encryption is turned off by using the dropdown menu "Security" and select Do Not Encrypt. Once encryption is off, hit Send.
+We want Edward to be able to open the email with your keyfile, so we want this first special message to be unencrypted. Make sure encryption is turned off by using the dropdown menu "Security" and select Do Not Encrypt. Once encryption is off, hit Send.
It may take two or three minutes for Edward to respond. In the meantime, you might want to skip ahead and check out the -
Step 4.b Send a test encrypted email
-Get Edward's key
+ +Get Edward's key
+To encrypt an email to Edward, you need its public key, so now you'll have to download it from a keyserver. You can do this in two different ways:
-Option 1. In the email answer you received from Edward as a response to your first email, Edward's public key was included. On the right of the email, just above the writing area, you will find an "OpenPGP" button that has a lock and a little wheel next to it. Click that, and select Discover next to the text: "This message was sent with a key that you don't have yet." A popup with Edward's key details will follow.
+Option 1. In the email answer you received from Edward as a response to your first email, Edward's public key was included. On the right of the email, just above the writing area, you will find an "OpenPGP" button that has a lock and a little wheel next to it. Click that, and select Discover next to the text: "This message was sent with a key that you don't have yet." A popup with Edward's key details will follow.
-Option 2. Open your OpenPGP manager and under "Keyserver" choose Discover Keys Online. Here, fill in Edward's email address, and import Edward's key.
+Option 2. Open your OpenPGP manager and under "Keyserver" choose Discover Keys Online. Here, fill in Edward's email address, and import Edward's key.
-The option Accepted (unverified) will add this key to your key manager, and now it can be used to send encrypted emails and to verify digital signatures from Edward.
+The option Accepted (unverified) will add this key to your key manager, and now it can be used to send encrypted emails and to verify digital signatures from Edward.
In the popup window confirming if you want to import Edward's key, you'll see many different emails that are all associated with its key. This is correct; you can safely import the key.
@@ -644,16 +636,14 @@ to download it from a keyserver. You can do this in two different ways: Edward's private key is required to decrypt it. Edward is the only one with its private key, so no one except Edward can decrypt it. -
-Send Edward an encrypted email
+Send Edward an encrypted email
Write a new email in your email program, addressed to edward-en@fsf.org. Make the subject "Encryption test" or something similar and write something in the body.
-This time, make sure encryption is turned on by using the dropdown menu "Security" and select Require Encryption. Once encryption is on, hit Send.
+This time, make sure encryption is turned on by using the dropdown menu "Security" and select Require Encryption. Once encryption is on, hit Send.
-
@@ -665,7 +655,7 @@ href="mailto:edward-en@fsf.org">edward-en@fsf.org. Make the subjectStep 5.a Sign a key
-In your email program's menu, go to OpenPGP Key Manager and select Key properties by right clicking on Edward's key.
+In your email program's menu, go to OpenPGP Key Manager and select Key properties by right clicking on Edward's key.
-Under "Your Acceptance," you can select Yes, I've verified in person this key has the correct fingerprint".
+Under "Your Acceptance," you can select Yes, I've verified in person this key has the correct fingerprint".
You've just effectively said "I trust that Edward's public key actually belongs to Edward." This doesn't mean much because Edward isn't @@ -1010,9 +1000,9 @@ invalid keys might be readable by surveillance programs.
sent you. Because Edward encrypted it with your public key, it will have a green checkmark a at the top "OpenPGP" button. -When using GnuPG, make a habit of glancing at that button. The program +
When using GnuPG, make a habit of glancing at that button. The program will warn you there if you get an email signed with a key that can't -be trusted.
+be trusted.
gpg--list-keys
. Yours should be listed in there, and later, so will Edward's (section 3). If you want to see only your key, you can use gpg --list-key [your@email]
.
+You can also use gpg --list-secret-key
to see your own private key.