pgp_workshop
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| pgp_workshop [2025/04/09 19:34] – usera | pgp_workshop [2025/05/29 07:47] (current) – [The actual Key signing] usera | ||
|---|---|---|---|
| Line 94: | Line 94: | ||
| {{ : | {{ : | ||
| Open a new mail, and write the mail address of the person you want to write to in the " | Open a new mail, and write the mail address of the person you want to write to in the " | ||
| + | |||
| + | ===== All platforms with Mozilla Thunderbird ===== | ||
| + | |||
| + | |||
| + | Once you have a set up thunderbird installation with your mail server, open it and do the following: | ||
| + | |||
| + | |||
| + | {{ : | ||
| + | Right click on your mail address on the left, then click on " | ||
| + | |||
| + | {{ : | ||
| + | In the "End to End encryption" | ||
| + | |||
| + | {{ : | ||
| + | Click on Generate-> | ||
| + | |||
| + | {{ : | ||
| + | After the key generation, click on Keyserver-> | ||
| + | |||
| + | {{ : | ||
| + | Go back to Settings, then select your key as the default key for your mail address | ||
| + | |||
| + | {{ : | ||
| + | Open a new mail, and write the mail address of the person you want to write to in the " | ||
| + | |||
| + | {{ : | ||
| + | We need now to activate a master password to encrypt the keys (and also the mails on your computer at rest) by going to Settings-> | ||
| + | |||
| + | {{ : | ||
| + | Then click on " | ||
| + | |||
| + | =====Encrypting and decrypting files with GPG, regardless of the fact that you use email to transfer them===== | ||
| + | |||
| + | ==== Using Windows and GNU4Win ==== | ||
| + | |||
| + | If you are on Windows and have installed GNU4WIN (see above), then you can simply open the file explorer, right click on a file and see the options "sign and encrypt" | ||
| + | {{ : | ||
| + | |||
| + | ==== On all platforms using the command line tool gpg ==== | ||
| + | |||
| + | This command line tool is already installed natively in many Linux distribution. Otherwise you can install it with the command, for example on Debian based distributions like Debian, Ubuntu or Linux Mint: | ||
| + | < | ||
| + | sudo apt-get install gnupg | ||
| + | </ | ||
| + | On Windows, it is installed with the installation of Gnu4Win. On MacOS, it can be installed with homebrew (see above). You can use it to bypass any of the mail system assumption, and therefore transfer things via not only any mail systems, but also other messaging apps, while being certain that it is end to end encrypted. | ||
| + | |||
| + | Here is a cheat sheet for the commands you can enter with it: | ||
| + | |||
| + | ^ Function | ||
| + | | generate a public/ | ||
| + | | list all public keys | < | ||
| + | | list all private keys | < | ||
| + | | send a key to a keyserver | < | ||
| + | | get the fingerprint of a key | < | ||
| + | | search for a public key on a server | < | ||
| + | | Receive a key from a keyserver | < | ||
| + | | Import a public key from a file | < | ||
| + | | Export a public key to a file | < | ||
| + | | Encrypt a file with GPG | < | ||
| + | | Decrypt a file with GPG | < | ||
| + | |||
| + | |||
| + | ===== Signing and verifying signatures with OpenPGP ===== | ||
| + | |||
| + | PGP is not only used to encrypt, but also to make " | ||
| + | - the sender of the message is the person you think they are, or | ||
| + | - that the file you downloaded has not been tampered with while being sent to you | ||
| + | |||
| + | The signature mechanism works in the opposite way as the encryption: | ||
| + | - Your **private key** is used to **sign** | ||
| + | - Your **public key** is used by the person receiving the message to **verify the signature** | ||
| + | |||
| + | The way it is done is the following: | ||
| + | - The file is **[[hashed|hashed]]** (see the paragraph below). | ||
| + | - This hashed file is encrypted with your private key | ||
| + | - The result is added at the end of your file, giving a **signed** file. | ||
| + | |||
| + | Actually, in most case you will do both: signing (with your private key) then encrypting (with the public key of someone else). The person receiving the message will decrypt it with their private key, and then extract the signature and verify it with your public key. | ||
| + | |||
| + | |||
| + | ==== First step if you only set up Thunderbird with PGP so far ==== | ||
| + | |||
| + | If you were on Windows and set up your keys with Kleopatra, the command line gpg tool will already know those keys. However, if you used the PGP key manager from thunderbird, | ||
| + | |||
| + | This is how to do it. First, go to the key manager, select your own key, that you will use to sign things with, and click on File-> | ||
| + | |||
| + | Then, open a command line, navigate to the directory where your secret key file is located and enter: | ||
| + | |||
| + | < | ||
| + | gpg --import [filename] | ||
| + | </ | ||
| + | |||
| + | where [filename] is the name of this secret key file. you then need to tell the gpg command tool to use this key as a default signing key. This is done by the command: | ||
| + | |||
| + | < | ||
| + | echo ' | ||
| + | </ | ||
| + | |||
| + | where [fingerprint] is the fingerprint of your key. You can find it with the command: | ||
| + | |||
| + | < | ||
| + | gpg --fingerprint [NAME] | ||
| + | </ | ||
| + | |||
| + | where [NAME] can be a small part of your mail address: gpg is cleaver enough to do a search among your keys and guess which one is the closest. | ||
| + | |||
| + | You are then ready to sign files and keys ! | ||
| + | ==== Checking the integrity of a downloaded file ==== | ||
| + | |||
| + | In some case you will download something from a website and there will be a signature associated with it, like in this example from the software [[https:// | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | You can download the file, the associated signature and the public key. In the veracrypt example, the public key can be found [[https:// | ||
| + | |||
| + | < | ||
| + | wget https:// | ||
| + | </ | ||
| + | |||
| + | In the download page, they tell you to check that the fingerprint is correct: | ||
| + | |||
| + | |||
| + | < | ||
| + | foo@bar:~ gpg --fingerprint veracrypt@idrix.fr | ||
| + | pub | ||
| + | 5069 A233 D55A 0EEB 174A 5FC3 821A CD02 680D 16DE | ||
| + | uid [ unknown] VeraCrypt Team (2018 - Supersedes Key ID=0x54DDD393) < | ||
| + | sub | ||
| + | sub | ||
| + | </ | ||
| + | |||
| + | and that it should be 5069 A233 D55A 0EEB 174A 5FC3 821A CD02 680D 16DE. | ||
| + | Once you checked the fingerprint the public key, you can sign it with your private key to indicate that you trust it: | ||
| + | |||
| + | < | ||
| + | foo@bar:~ gpg --sign-key veracrypt@idrix.fr | ||
| + | pub rsa4096/ | ||
| + | | ||
| + | | ||
| + | sub rsa4096/ | ||
| + | | ||
| + | sub rsa4096/ | ||
| + | | ||
| + | [ unknown] (1). VeraCrypt Team (2018 - Supersedes Key ID=0x54DDD393) < | ||
| + | |||
| + | |||
| + | pub rsa4096/ | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | | ||
| + | |||
| + | Are you sure that you want to sign this key with your | ||
| + | key "my Name < | ||
| + | |||
| + | Really sign? (y/N) y | ||
| + | </ | ||
| + | |||
| + | you can then check that you have the correct file by entering: | ||
| + | |||
| + | < | ||
| + | foo@bar:~ gpg --verify " | ||
| + | gpg: Signature made Tue 04 Feb 2025 15:53:43 CET | ||
| + | gpg: using RSA key 5069A233D55A0EEB174A5FC3821ACD02680D16DE | ||
| + | gpg: checking the trustdb | ||
| + | gpg: marginals needed: 3 completes needed: 1 trust model: pgp | ||
| + | gpg: depth: 0 valid: | ||
| + | gpg: depth: 1 valid: | ||
| + | gpg: next trustdb check due at 2025-11-29 | ||
| + | gpg: Good signature from " | ||
| + | </ | ||
| + | |||
| + | This Good signature indication tells you that you have downloaded a file that was certified as genuine by the owner of the private key associated with veracrypt, and that it has not been tampered with. | ||
| + | |||
| + | ==== Signing a document ==== | ||
| + | |||
| + | With the command line, you can sign a document with < | ||
| + | |||
| + | ==== Sign the public key of someone ==== | ||
| + | |||
| + | GPG is a lot based on the trust that you are talking to the right person. Therefore, to tell to the whole world that you trust some public key, you should **sign the public keys** of other people. | ||
| + | |||
| + | === Note if you used Thunderbird and not Kleopatra === | ||
| + | |||
| + | To sign a key, you need to use the command line gpg, so as said before, if you used Kleopatra to generate your keys, you are good to go, as the gpg tool will already know your keys. However, if you used Thunderbird, | ||
| + | - First, go to the PGP key manager in Thunderbird | ||
| + | - Select the public key you want to sign, then right click and click on Export public key to file and select a location on your computer | ||
| + | - Open a command line, navigate to the folder where your file is and enter '' | ||
| + | - repeat the operaton for each key you want to sign | ||
| + | |||
| + | === The actual Key signing === | ||
| + | |||
| + | This is how to do it (as recommended [[https:// | ||
| + | |||
| + | - Alice (you) get the public key of Bob | ||
| + | - Alice sign it with her private key: '' | ||
| + | - Alice exports, then encrypts the signed key with Bob public key, with the following command: < | ||
| + | - Alice emails the key to Bob using the mail address associated with the key | ||
| + | - Bob receives it, then decrypt it with his private key and import it: '' | ||
| + | - He can then send it to a keyserver, containing Alice signature: '' | ||
pgp_workshop.1744227256.txt.gz · Last modified: by usera
