by Fajar Priyanto, 2004 (last update 2019)
1. You're going to need the gpg program. It's already being installed by default.
2. Create your own key (type this as yourself, not root):
gpg --gen-keyFollow the instructions, it's very clear and easy.
3. Check that it's already created:
You will see something like this with your own credentials:
pub rsa4096 2004-03-15 [SC] D9C687FBA8DB7AB93E06E737931BC29844664E2D uid [ultimate] Fajar Priyanto <email@example.com> sub rsa4096 2004-03-15 [E]
4. Now, in order to export your public key:
gpg --armor --output fajar-pub.key --export firstname.lastname@example.org
A file called fajar-pub.key will be created in the current directory. This is a copy of your public key. This is also the file that people must import to verify your signed emails. You can publish it in keyservers around the world, or you can send it directly to the people requesting it, or you can place it in your website for others to download.
If you look inside the file, it will be like this:
-- --BEGIN PGP PUBLIC KEY BLOCK-- -- mQGiBEBVTw8RBACaYvnDkgqNWyktg3urdE9mrpv63x3Iux2zVkuZk8pIRp5HeR/V [snip snip...] B394acuU4FdGN/EynYUAn1aRvNmgs0/IU2MDzYQpbHIaqpkE =RIZC -- --END PGP PUBLIC KEY BLOCK-- --
Also, you might want to back up your secret key to a secure medium (not just one floppy: this will get damaged), you can use the following command:
$ gpg --armor --output secret.asc --export-secret-keys email@example.com
This will create a textfile containing your secret or private key, with the filename secret.asc. Do not hand it to someone you do not trust 100%. Hide it in a safe place (or better, more than one).
Finally, it is advisable to generate a revocation certificate and store it in a safe place away from your secret key. In case your secret key gets into the wrong hands, you can revoke it so it can not easily be abused by others. The command to do this is
$ gpg --armor --output revoker.asc --gen-revoke firstname.lastname@example.org
This will create a textfile with the name revoker.asc containing the revocation certificate.
You now can communicate in a more secure way if you want to. I know this how-to is very short and might not be very clear. Well, please give me suggestions and I will improve it when the time comes. Also I intend to write the second part of this topic which covers how to ENCRYPT messages, import other public keys, and install Crypto Plug-ins. Special thanks to Tim Sawchuck and Philip Cronje and all my friends in the Mandrake List.
|To be sure the "passphrase agent" (gpg-agent) is enabled, check your ~/.gnupg/gpg.conf and eventually uncomment the line containing "use-agent". |
In KMail's , select , then . On the GPG Agent page, give a path to which logs can be written ( ), in case of problems. You can check the log in KMail's . It's probably a good idea, too, to increase the cache time - I use 3600.
|The following startup and shutdown scripts may be already in use from your distro, but not written in this path. Do not install these scripts unless you have problems with startup and shutdown|
#!/bin/bash killall gpg-agent eval `gpg-agent --daemon`
Save it and make it executable.
In the same way you would clean up gpg-agent on shutdown, so if you do not have it already, create another directory called shutdown into ~/.config/plasma-workspace and create in it another script file called stop_gpgagent.sh containing
#!/bin/bash killall gpg-agent
Save it and make it executable.
ps -edalf | grep gpg-agentwill list any running instances of gpg-agent.
killall gpg-agentstops all instances
eval "$(gpg-agent --daemon)"will restart the agent
gpg-agent statusshould tell you if the agent is running.