<title>Email Self-Defense - a guide to fighting surveillance with GnuPG
encryption</title>
<meta name="keywords" content="GnuPG, GPG, openpgp, surveillance, privacy,
-email, security, GnuPG2" />
+email, security, GnuPG2, encryption" />
<meta name="description" content="Email surveillance violates our fundamental
rights and makes free speech risky. This guide will teach you email
self-defense in 40 minutes with GnuPG." />
<li><a href="/sv">svenska - v4.0</a></li>
<li><a href="/tr">Türkçe - v5.0</a></li>
<li><a href="/zh-hans">简体中文 - v4.0</a></li>-->
-<li><a href="https://libreplanet.org/wiki/GPG_guide/Translation_Guide">
-<strong><span style="color: #2F5FAA;">Translate!</span></strong></a></li>
+<li><strong><a href="https://libreplanet.org/wiki/GPG_guide/Translation_Guide">
+Translate!</a></strong></li>
</ul>
<ul id="menu" class="os">
<p>Open your email program and follow the wizard (step-by-step walkthrough)
that sets it up with your email account. This usually starts from "Account Settings" → "Add Mail Account". You should get the email server settings from your systems administrator or the help section of your email account.</p>
-<br />
+
<!-- ~~~~~~~~~ Troubleshooting ~~~~~~~~~ -->
<div class="troubleshooting">
<!-- ~~~~~~~~~ MACOS ~~~~~~~~~ -->
<div class="troubleshooting">
-<h4>MacOS</h4>
+<h4>macOS</h4>
<dl>
<dt>Use a third-party package manager to install GnuPG</dt>
<dd>Your macOS comes with a program called "Terminal" pre-installed, which we'll use to set up your encryption with GnuPG, using the command line. However, the default macOS package manager makes it difficult to install GnuPG and other pieces of free software (like Emacs, GIMP, or Inkscape).<br/>
To make things easier, we recommend setting up the third-party package manager "Homebrew" to install GnuPG. Copy the link on the home page of <a href="https://brew.sh/">Homebrew</a> and paste it in Terminal. Click "Enter" and wait for it to finalize.<br/>
When it is done, install the program by entering the following code in Terminal:<br/>
-<span style="color:#2f5faa; font-family: monospace;">brew install gnupg gnupg2</span>. After installation is done, you can follow the steps of the rest of this guide.</dd>
+<code>brew install gnupg gnupg2</code>. After installation is done, you can follow the steps of the rest of this guide.</dd>
</dl>
</div><!-- /.troubleshooting -->
<p>Your private key is more like a physical key, because you keep it to
yourself (on your computer). You use GnuPG and your private key together to
-descramble encrypted emails other people send to you. <span style="font-weight:
-bold;">You should never share your private key with anyone, under any
-circumstances.</span></p>
+descramble encrypted emails other people send to you. <strong>You should never share your private key with anyone, under any
+circumstances.</strong></p>
<p>In addition to encryption and decryption, you can also use these keys to
sign messages and check the authenticity of other people's signatures. We'll
<p><img
src="../static/img/en/screenshots/step2a-03-make-keypair.png"
alt="Step 2.A: Set your passphrase" /></p>
-<br />
</div><!-- /.sidebar -->
<div class="main">
<h3><em>Step 2.a</em> Make a keypair</h3>
-<h6>Make your keypair</h6>
-<p>Open a terminal using <span style="color:#2f5faa; font-family: monospace;">ctrl + alt + t</span> (on GNU/linux), or find it in your applications, and use the following code to create your keypair:</p>
+
+<h4>Make your keypair</h4>
+<p>Open a terminal. You should be able to find it in your applications (some GNU/Linux systems respond to the the <kbd>ctrl + alt + t</kbd> shortcut). Use the following code to create your keypair in the terminal:</p>
<p class="notes">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.</p>
-<p># <span style="color:#2f5faa; font-family: monospace;">gpg --full-generate-key</span> to start the process.</p>
-<p># To answer what kind of key you would like to create, select the default option <span style="color:#2f5faa; font-family: monospace;"> 1 RSA and RSA</span>.</p>
-<p># Enter the following keysize: <span style="color:#2f5faa; font-family: monospace;">4096</span> for a strong key.</p>
-<p># Choose the expiration date, we suggest <span style="color:#2f5faa; font-family: monospace;">2y</span> (2 years).</p>
+<p># <code>gpg --full-generate-key</code> to start the process.</p>
+<p># To answer what kind of key you would like to create, select the default option: <samp>1 RSA and RSA</samp>.</p>
+<p># Enter the following keysize: <code>4096</code> for a strong key.</p>
+<p># Choose the expiration date, we suggest <code>2y</code> (2 years).</p>
<p>Follow the prompts to continue setting up with your personal details.</p>
-<br />
-<h6>Set your passphrase</h6>
+<h4>Set your passphrase</h4>
<p>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
any recognizable patterns, such as birthdays, telephone numbers, pets' names,
song lyrics, quotes from books, and so on.</p>
-<br />
-
<!-- ~~~~~~~~~ Troubleshooting ~~~~~~~~~ -->
<div class="troubleshooting">
<dl>
<dt>GnuPG is not installed</dt>
<dd>
-GPG is not installed. You can check if this is the case with the command <span style="color:#2f5faa; font-family: monospace;">gpg --version</span>.
+GPG is not installed. You can check if this is the case with the command <code>gpg --version</code>.
If GnuPG is not installed, it would bring up the following result on most GNU/Linux operating systems, or something like it:
-<span style="color:#2f5faa; font-family: monospace;">Command 'gpg' not found, but can be installed with:
- sudo apt install gnupg</span>. Follow that command and install the program.</dd>
+<samp>Command 'gpg' not found, but can be installed with:
+ sudo apt install gnupg</samp>. Follow that command and install the program.</dd>
<dt>I took too long to create my passphrase</dt>
<dd>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.</dd>
<dt>How can I see my key?</dt>
<dd>
-Use the following command to see all keys <span style="color:#2f5faa; font-family: monospace;">gpg --list-keys</span>. Yours should be listed in there, and later, so will Edward's (<a href="#section3">section 3</a>). If you want to see only your key, you can use <span style="color:#2f5faa; font-family: monospace;">gpg --list-key [your@email]</span>.
-You can also use <span style="color:#2f5faa; font-family: monospace;">gpg --list-secret-key</span> to see your own private key.</dd>
+Use the following command to see all keys: <code>gpg--list-keys</code>. Yours should be listed in there, and later, so will Edward's (<a href="#section3">section 3</a>). If you want to see only your key, you can use <code>gpg --list-key [your@email]</code>.
+You can also use <code>gpg --list-secret-key</code> to see your own private key.</dd>
<dt>More resources</dt>
<dd>For more information about this process, you can also refer to <a
<h3><em>Step 2.b</em> Some important steps following creation</h3>
-<h6>Upload your key to a keyserver</h6>
+<h4>Upload your key to a keyserver</h4>
<p>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.</p>
-<p># Copy your keyID <span style="color:#2f5faa; font-family: monospace;">gnupg --list-key [your@email]</span> 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.</p>
-<p># Upload your key to a server: <span style="color:#2f5faa; font-family: monospace;">gpg --send-key [keyID]</span></p>
-
-<br />
+<p># Copy your keyID: <code>gpg --list-key [your@email]</code> 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.</p>
+<p># Upload your key to a server:
+<code>gpg --send-key [keyID]</code></p>
-<h6>Export your key to a file</h6>
+<h4>Export your key to a file</h4>
<p>Use the following command to export your secret key so you can import it into your email client at the next <a href="#section3">step</a>. 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:</p>
-<p><span style="color:#2f5faa; font-family: monospace;">
+<p><code>
$ gpg --export-secret-keys -a [keyID] > my_secret_key.asc<br/>
$ gpg --export -a [keyID] > my_public_key.asc
-</span></p>
+</code></p>
-<br />
-
-<h6>Generate a revocation certificate</h6>
+<h4>Generate a revocation certificate</h4>
<p>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 <a href="#step-6c"> step 6.C</a> 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 <a href="#section5">Section 5</a>.</p>
-<p># Copy your keyID <span style="color:#2f5faa; font-family: monospace;">gnupg --list-key [your@email]</span> 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.</p>
-<p># Generate a revocation certificate: <span style="color:#2f5faa; font-family: monospace;">gpg --gen-revoke --output revoke.asc [keyID]</span></p>
-<p># It will prompt you to give a reason for revocation, we recommend to use <span style="color:#2f5faa; font-family: monospace;">1 "key has been compromised"</span></p>
+<p># Copy your keyID: <code>gpg --list-key [your@email]</code> 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.</p>
+<p># Generate a revocation certificate: <code>gpg --gen-revoke --output revoke.asc [keyID]</code></p>
+<p># It will prompt you to give a reason for revocation, we recommend to use <samp>1 = key has been compromised</samp>.</p>
<p># You don't have to fill in a reason, but you can, then press enter for an empty line, and confirm your selection.</p>
-<br />
<!-- ~~~~~~~~~ Troubleshooting ~~~~~~~~~ -->
<div class="troubleshooting">
<dt>My key doesn't seem to be working or I get a "permission denied."</dt>
<dd><p>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.</p>
-<p># Check your permissions: <span style="color:#2f5faa; font-family: monospace;">ls -l ~/.gnupg/*</span></p>
+<p># Check your permissions: <code>ls -l ~/.gnupg/*</code></p>
<p># Set permissions to read, write, execute for only yourself, no others. These are the recommended permissions for your folder. <br/>
-You can use the code <span style="color:#2f5faa; font-family: monospace;">chmod 700 ~/.gnupg</span></p>
+You can use the code: <code>chmod 700 ~/.gnupg</code></p>
<p># Set permissions to read and write for yourself only, no others. These are the recommended permissions for the keys inside your folder. <br/>
-You can use the code: <span style="color:#2f5faa; font-family: monospace;">chmod 600 ~/.gnupg/*</span></p>
+You can use the code: <code>chmod 600 ~/.gnupg/*</code></p>
<p class="notes">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 <a href="https://helpdeskgeek.com/linux-tips/understanding-linux-permissions-chmod-usage/">this detailed information guide</a>.</p>
</dd>
<dd>
<p>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:</p>
-<p><span style="color:#2f5faa; font-family: monospace;">
+<p><code>
$ gpg --export-secret-keys -a [keyID] > my_private_key.asc<br/>
$ gpg --export -a [keyID] > my_public_key.asc<br/>
$ gpg --import my_private_key.asc<br/>
$ gpg --import my_public_key.asc
-</span></p>
+</code></p>
<p>Ensure that the keyID printed is the correct one, and if so, then go ahead and add ultimate trust for it:</p>
-<p><span style="color:#2f5faa; font-family: monospace;">
+<p><code>
$ gpg --edit-key [your@email]
-</span></p>
+</code></p>
-<p>Because this is your key, you should choose <span style="color:#2f5faa; font-family: monospace;">ultimate</span>. You shouldn't trust anyone else's key ultimately.</p>
+<p>Because this is your key, you should choose <code>ultimate</code>. You shouldn't trust anyone else's key ultimately.</p>
<p class="notes"> Refer to <a href="#step-2b">troubleshoot in step 2.B</a> 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</p>
</dd>
<p>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.</p>
-<p># Open your email client and use "Tools" → <span style="color:#2f5faa;">OpenPGP Manager</span></p>
-<p># Under "File" → <span style="color:#2f5faa;">Import Secret Key(s) From File</span></p>
-<p># Select the file you saved under the name [my_secret_key.asc] in step <a href="#step-3b">step 3.b</a> when you exported your key</p>
+<p># Open your email client and use "Tools" → <i>OpenPGP Manager</i></p>
+<p># Under "File" → <i>Import Secret Key(s) From File</i></p>
+<p># Select the file you saved under the name [my_secret_key.asc] in step <a href="#step-2b">step 2.b</a> when you exported your key</p>
<p># Unlock with your passphrase</p>
<p># You will receive a "OpenPGP keys successfully imported" window to confirm success</p>
-<p># Go to "Edit" (in Icedove) or "Tools" (in Thunderbird) → "Account settings" → "End-To-End Encryption," and make sure your key is imported and select <span style="color:#2f5faa;">Treat this key as a Personal Key</span>.</p>
+<p># Go to "Edit" (in Icedove) or "Tools" (in Thunderbird) → "Account settings" → "End-To-End Encryption," and make sure your key is imported and select <i>Treat this key as a Personal Key</i>.</p>
</div><!-- End .main -->
<dl>
<dt>I'm not sure the import worked correctly</dt>
<dd>
-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 <span style="color:#2f5faa;">Add key</span> option. Make sure you have the correct, active, secret key file.
+Look for "Account settings" → "End-To-End Encryption." Here you can see if your personal key associated with this email is found. If it is not, you can try again via the <span style="color:#2f5faa;">Add key</span> option. Make sure you have the correct, active, secret key file.
</dd>
<dt class="feedback">Don't see a solution to your problem?</dt>
<p>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 <span style="color:#2f5faa;">Send Public Keys by Email</span>. 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.</p>
+on your key and select <i>Send Public Keys by Email</i>. 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.</p>
<p>Address the message to <a
href="mailto:edward-en@fsf.org">edward-en@fsf.org</a>. Put at least one word
(whatever you want) in the subject and body of the email. Don't send yet.</p>
-<p>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 <span style="color:#2f5faa">Do Not Encrypt</span>. Once encryption is off, hit Send.</p>
+<p>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 <i>Do Not Encrypt</i>. Once encryption is off, hit Send.</p>
<p class="notes">It may take two or three minutes for Edward to
respond. In the meantime, you might want to skip ahead and check out the <a
<p><img
src="../static/img/en/screenshots/step4b-option1-verify-key.png"
alt="Step 4.B Option 1. Verify key" /></p>
-
<br />
<p><img
src="../static/img/en/screenshots/step4b-option2-import-key.png"
<div class="main">
<h3><em>Step 4.b</em> Send a test encrypted email</h3>
-<h6>Get Edward's key</h6>
+
+<h4>Get Edward's key</h4>
+
<p>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:</p>
-<p><strong>Option 1.</strong> 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 <span style="color:#2f5faa">Discover</span> 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.</p>
+<p><strong>Option 1.</strong> 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 <span style="color:#2f5faa">Discover</span> next to the text: "This message was signed with a key that you don't yet have." A popup with Edward's key details will follow.</p>
-<p><strong>Option 2.</strong> Open your OpenPGP manager and under "Keyserver" choose <span style="color:#2f5faa">Discover Keys Online</span>. Here, fill in Edward's email address, and import Edward's key.</p>
+<p><strong>Option 2.</strong> Open your OpenPGP manager and under "Keyserver" choose <i>Discover Keys Online</i>. Here, fill in Edward's email address, and import Edward's key.</p>
-<p>The option <span style="color:#2f5faa">Accepted (unverified)</span> 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.</p>
+<p>The option <i>Accepted (unverified)</i> 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.</p>
<p class="notes">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.</p>
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.</p>
-<br />
-<h6>Send Edward an encrypted email</h6>
+<h4>Send Edward an encrypted email</h4>
<p> Write a new email in your email program, addressed to <a
href="mailto:edward-en@fsf.org">edward-en@fsf.org</a>. Make the subject
"Encryption test" or something similar and write something in the body.</p>
-<p>This time, make sure encryption is turned on by using the dropdown menu "Security" and select <span style="color:#2f5faa">Require Encryption</span>. Once encryption is on, hit Send.</p>
+<p>This time, make sure encryption is turned on by using the dropdown menu "Security" and select <i>Require Encryption</i>. Once encryption is on, hit Send.</p>
-<br />
<!-- ~~~~~~~~~ Troubleshooting ~~~~~~~~~ -->
<div class="troubleshooting">
<dl>
<dt>"Recipients not valid, not trusted or not found"</dt>
-<dd>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.</dd>
+<dd>You could get the above error message, or something along these lines: "Unable to send this message with end-to-end encryption, because there are problems with the keys of the following recipients: ..." In these cases, 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.</dd>
<dt>Unable to send message</dt>
-<dd>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 <span style="color:#2f5faa">Yes, but I have not verified that this is the correct key</span> in the "Acceptance" option at the bottom of this window. Resend the email.</dd>
+<dd>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 <i>Yes, but I have not verified that this is the correct key</i> in the "Acceptance" option at the bottom of this window. Resend the email.</dd>
<dt>I can't find Edward's key</dt>
<dd>Close the pop-ups that have appeared since you clicked Send. Make sure
<p>For greater security against potential attacks, you can turn off
HTML. Instead, you can render the message body as plain text. In order
-to do this in Icedove or Thunderbird, go to View > Message Body As > Plain
-Text.</p>
+to do this in Icedove or Thunderbird, go to "View" → "Message Body As" → <i>Plain
+Text</i>.</p>
</div><!-- End .main -->
</div><!-- End #step-headers_unencrypted .step-->
message, GnuPG may ask you for your password before it sends the message,
because it needs to unlock your private key for signing.</p>
-<p>In "Account Settings" → "End-To-End-Encryption" you can opt to <span style="color:#2f5faa">add digital signature by default</span>.</p>
+<p>In "Account Settings" → "End-To-End-Encryption" you can opt to <i>add digital signature by default</i>.</p>
</div><!-- End .main -->
</div><!-- End #step-4d .step -->
<p>Signing keys and signing messages use the same type of mathematical
operation, but they carry very different implications. It's a good practice
to generally sign your email, but if you casually sign people's keys, you
-may accidently end up vouching for the identity of an imposter.</p>
+may accidentally end up vouching for the identity of an imposter.</p>
<p>People who use your public key can see who has signed it. Once you've
used GnuPG for a long time, your key may have hundreds of signatures. You
<h3><em>Step 5.a</em> Sign a key</h3>
-<p>In your email program's menu, go to OpenPGP Key Manager and select <span style="color:#2f5faa">Key properties</span> by right clicking on Edward's key.</p>
+<p>In your email program's menu, go to OpenPGP Key Manager and select <i>Key properties</i> by right clicking on Edward's key.</p>
-<p>Under "Your Acceptance," you can select <span style="color:#2f5faa">Yes, I've verified in person this key has the correct fingerprint"</span>.</p>
+<p>Under "Your Acceptance," you can select <i>Yes, I've verified in person this key has the correct fingerprint"</i>.</p>
<p class="notes">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
sent you. Because Edward encrypted it with your public key, it will have a
green checkmark a at the top "OpenPGP" button.</p>
-<p><b>When using GnuPG, make a habit of glancing at that button. The program
+<p><strong>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.</b></p>
+be trusted.</strong></p>
</div><!-- End .main -->
</div><!-- End #step-6b .step -->
src="../static/js/scripts.js"></script>
<!-- Piwik -->
<script type="text/javascript">
- // @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-2.0-or-later
+ // @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-2.0-or-later
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);