{"id":960,"date":"2017-06-09T08:20:30","date_gmt":"2017-06-09T05:20:30","guid":{"rendered":"https:\/\/community.virtono.com\/?p=960"},"modified":"2017-06-11T08:46:49","modified_gmt":"2017-06-11T05:46:49","slug":"how-to-use-gpg-to-encrypt-and-sign-messages","status":"publish","type":"post","link":"https:\/\/www.virtono.com\/community\/news-announcements\/how-to-use-gpg-to-encrypt-and-sign-messages\/","title":{"rendered":"How To Use GPG to Encrypt and Sign Messages"},"content":{"rendered":"<p><b>Introduction<\/b><\/p>\n<p><span style=\"font-weight: 400\">GNU Privacy Guard it\u2019s also known as GPG it is a public key cryptography implementation. It is very helpful for transferring secure of information between parties, it\u2019s also used for verifying that the message\u2019s origin is genuine or not.<\/span><\/p>\n<p><span style=\"font-weight: 400\">In the following tutorial, use will know how to work on GPG and how to implement it. For working on this, we will be using Ubuntu 16.04 server for its demonstration and we will also use some more instruction for other distribution. <\/span><\/p>\n<p>&nbsp;<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.virtono.com\/community\/news-announcements\/how-to-use-gpg-to-encrypt-and-sign-messages\/#_Knowing_the_working_of_public_key_encryption\" title=\"\u00a0Knowing the working of public key encryption\">\u00a0Knowing the working of public key encryption<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.virtono.com\/community\/news-announcements\/how-to-use-gpg-to-encrypt-and-sign-messages\/#There_is_a_common_problem_which_is_faced_by_many_users_that_is_how_to_communicate_safely_and_validate_identity_of_the_party_they_are_talking_to_There_were_many_schemes_for_hwklping_the_users_but_at_last_at_some_point_the_transfer_of_a_password_or_other_identifying_credentials_over_an_insecure_medium\" title=\"There is a common problem which is faced by many users that is how to communicate safely and validate identity of the party they are talking to. There were many schemes for hwklping the users but at last at some point the transfer of a password or other identifying credentials, over an insecure medium.\">There is a common problem which is faced by many users that is how to communicate safely and validate identity of the party they are talking to. There were many schemes for hwklping the users but at last at some point the transfer of a password or other identifying credentials, over an insecure medium.<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"_Knowing_the_working_of_public_key_encryption\"><\/span><span style=\"font-weight: 400\">\u00a0Knowing the working of public key encryption<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h4><span class=\"ez-toc-section\" id=\"There_is_a_common_problem_which_is_faced_by_many_users_that_is_how_to_communicate_safely_and_validate_identity_of_the_party_they_are_talking_to_There_were_many_schemes_for_hwklping_the_users_but_at_last_at_some_point_the_transfer_of_a_password_or_other_identifying_credentials_over_an_insecure_medium\"><\/span><span style=\"font-weight: 400\">There is a common problem which is faced by many users that is how to communicate safely and validate identity of the party they are talking to. There were many schemes for hwklping the users but at last at some point the transfer of a password or other identifying credentials, over an insecure medium.<\/span><span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><b>Ensure That Only the Intended Party Can Read<\/b><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">To get around this issue, GPG relies on a security concept known as public key encryption. The idea is that you can split the encrypting and decrypting stages of the transmission into two separate pieces. That way, you can freely distribute the encrypting portion, as long as you secure the decrypting portion.<\/span><\/p>\n<p><span style=\"font-weight: 400\">This would allow for a one-way message transfer that can be created and encrypted by anyone, but only be decrypted by the designated user (the one with the private decrypting key). If both of the parties create public\/private key pairs and give each other their public encrypting keys, they can both encrypt messages to each other.<\/span><\/p>\n<p><span style=\"font-weight: 400\">So in this scenario, each party has their own private key and the other user&#8217;s public key.<\/span><\/p>\n<p><b>Validate the Identity of the Sender<\/b><\/p>\n<p><span style=\"font-weight: 400\">It gives a huge benefit to it user that the sender of a message can \u201csign\u201c the message with their private key. It also verifies that the signature is actually is being sent by the indicated user <\/span><\/p>\n<p><span style=\"font-weight: 400\">Set Up GPG Keys<\/span><\/p>\n<p><span style=\"font-weight: 400\">GPG is installed by default in most distributions.<\/span><\/p>\n<p><span style=\"font-weight: 400\">If for any reason GPG is not installed, on\u00a0<\/span><b>Ubuntu<\/b><span style=\"font-weight: 400\">\u00a0and\u00a0<\/span><b>Debian<\/b><span style=\"font-weight: 400\">, you can update the local repo index and install it by typing:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">sudo apt-get update<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">sudo apt-get install gnupg<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">On\u00a0<\/span><b>CentOS<\/b><span style=\"font-weight: 400\">, you can install GPG by typing:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">sudo yum install gnupg2<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">To begin using GPG to encrypt your communications, you need to create a key pair. You can do this by issuing the following command:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;gen-key<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">This will take you through a few questions that will configure your keys:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Please select what kind of key you want:\u00a0<\/span><b>(1) RSA and RSA (default)<\/b><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">What keysize do you want?\u00a0<\/span><b>4096<\/b><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Key is valid for?\u00a0<\/span><b>1y<\/b><span style=\"font-weight: 400\">\u00a0(expires after 1 year. If you are just testing, you may want to create a short-lived key the first time by using a number like &#8220;3&#8221; instead.)<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Is this correct?\u00a0<\/span><b>y<\/b><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Real name:\u00a0<\/span><b>your real name here<\/b><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Email address:\u00a0<\/span><a href=\"mailto:your_email@address.com\"><b>your_email@address.com<\/b><\/a><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Comment:\u00a0<\/span><b>Optional comment that will be visible in your signature<\/b><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Change (N)ame, (C)omment, (E)mail or (O)kay\/(Q)uit?\u00a0<\/span><b>O<\/b><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Enter passphrase:\u00a0<\/span><b>Enter a secure passphrase here (upper &amp; lower case, digits, symbols)<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">At this point,\u00a0<\/span><span style=\"font-weight: 400\">gpg<\/span><span style=\"font-weight: 400\">\u00a0will generate the keys using entropy.\u00a0<\/span><i><span style=\"font-weight: 400\">Entropy<\/span><\/i><span style=\"font-weight: 400\">\u00a0describes the amount of unpredictability and nondeterminism that exists in a system. GPG needs this entropy to generate a secure set of keys.<\/span><\/p>\n<p><span style=\"font-weight: 400\">This process may take a long time depending on how active your system is and the keysize you selected. To generate additional entropy more easily, you can\u00a0<\/span><span style=\"font-weight: 400\">use a tool called haveged<\/span><span style=\"font-weight: 400\">. Open up a new terminal and SSH into the server again to set up\u00a0<\/span><span style=\"font-weight: 400\">haveged<\/span><span style=\"font-weight: 400\">\u00a0on your server.<\/span><\/p>\n<p><b>Create a Revocation Certificate<\/b><\/p>\n<p><span style=\"font-weight: 400\">You need to have a way of invalidating your key pair in case there is a security breach or in case you lose your secret key. There is an easy way of doing this with the GPG software.<\/span><\/p>\n<p><span style=\"font-weight: 400\">This should be done as soon as you make the key pair, not when you need it. This revocation key must be generated ahead of time and kept in a secure, separate location in case your computer is compromised or inoperable. To generate a revocation key, type:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;output ~\/<\/span><span style=\"font-weight: 400\">revocation.crt<\/span><span style=\"font-weight: 400\"> &#8211;gen-revoke <\/span><span style=\"font-weight: 400\">your_email@address.com<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">You will be asked to confirm the revocation key creation and then prompted for the reason that it is being revoked. This information will be visible to other users if the revocation is used in the future. You can choose any of the available options, but since this is being done ahead of time, you won&#8217;t have the specifics. Often, it is a good idea to create a revocation certificate for each of the likely scenarios for maximum flexibility.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Afterwards, you will then be asked to supply a comment and finally, to confirm the selections. Before creating the revocation certificate, you will need to enter your GPG key&#8217;s passphrase to confirm your identity. The revocation certificate will be written to the file specified by the\u00a0<\/span><span style=\"font-weight: 400\">&#8211;output<\/span><span style=\"font-weight: 400\">\u00a0flag (<\/span><span style=\"font-weight: 400\">revocation.crt<\/span><span style=\"font-weight: 400\">\u00a0in our example):<\/span><\/p>\n<p><span style=\"font-weight: 400\">Output<\/span><\/p>\n<p><span style=\"font-weight: 400\">Revocation certificate created.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">Please move it to a medium which you can hide away; if Mallory gets<\/span><\/p>\n<p><span style=\"font-weight: 400\">access to this certificate he can use it to make your key unusable.<\/span><\/p>\n<p><span style=\"font-weight: 400\">It is smart to print this certificate and store it away, just in case<\/span><\/p>\n<p><span style=\"font-weight: 400\">your media become unreadable. \u00a0But have some caution: \u00a0The print system of<\/span><\/p>\n<p><span style=\"font-weight: 400\">your machine might store the data and make it available to others!<\/span><\/p>\n<p><span style=\"font-weight: 400\">You should immediately restrict the permissions on the generated certificate file in order to prevent unauthorized access:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">chmod 600 ~\/<\/span><span style=\"font-weight: 400\">revocation.crt<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">The revocation certificate must be kept secure so that other users cannot revoke your key. As the message states, you should consider backing the certificate up to other machines and printing it out, as long as you can secure it properly.<\/span><\/p>\n<p><span style=\"font-weight: 400\">How To Import Other Users&#8217; Public Keys<\/span><\/p>\n<p><span style=\"font-weight: 400\">GPG would be pretty useless if you could not accept other public keys from people you wished to communicate with.<\/span><\/p>\n<p><span style=\"font-weight: 400\">You can import someone&#8217;s public key in a variety of ways. If you&#8217;ve obtained a public key from someone in a text file, GPG can import it with the following command:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;import <\/span><span style=\"font-weight: 400\">name_of_pub_key_file<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">There is also the possibility that the person you are wishing to communicate with has uploaded their key to a public key server. These key servers are used to house people&#8217;s public keys from all over the world.<\/span><\/p>\n<p><span style=\"font-weight: 400\">A popular key server that syncs its information with a variety of other servers is the MIT public key server. You can search for people by their name or email address by going here in your web browser:<\/span><\/p>\n<p><span style=\"font-weight: 400\">https:\/\/pgp.mit.edu\/<\/span><\/p>\n<p><span style=\"font-weight: 400\">You can also search the key server from within GPG by typing the following:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;keyserver pgp.mit.edu \u00a0&#8211;search-keys <\/span><span style=\"font-weight: 400\">search_parameters<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">You can use this method of searching by name or email address. You can import keys that you find by following the prompts.<\/span><\/p>\n<p><span style=\"font-weight: 400\">How To Verify and Sign Keys<\/span><\/p>\n<p><span style=\"font-weight: 400\">While you can freely distribute your generated public key file and people can use this to contact you in a secure way, it is important to be able to trust that the key belongs to who you think it does during the initial public key transmission.<\/span><\/p>\n<p><b>Verify the Other Person&#8217;s Identity<\/b><\/p>\n<p><span style=\"font-weight: 400\">How do you know that the person giving you the public key is who they say they are? In some cases, this may be simple. You may be sitting right next to the person with your laptops both open and exchanging keys. This should be a pretty secure way of identifying that you are receiving the correct, legitimate key.<\/span><\/p>\n<p><span style=\"font-weight: 400\">But there are many other circumstances where such personal contact is not possible. You may not know the other party personally, or you may be separated by physical distance. If you never want to communicate over insecure channels, verification of the public key could be problematic.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Luckily, instead of verifying the entire public keys of both parties, you can simply compare the &#8220;fingerprint&#8221; derived from these keys. This will give you a reasonable assurance that you both are using the same public key information.<\/span><\/p>\n<p><span style=\"font-weight: 400\">You can get the fingerprint of a public key by typing:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;fingerprint <\/span><span style=\"font-weight: 400\">your_email@address.com<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Output<\/span><\/p>\n<p><span style=\"font-weight: 400\">pub \u00a0\u00a04096R\/311B1F84 2013-10-04<\/span><\/p>\n<p><span style=\"font-weight: 400\"> \u00a0\u00a0\u00a0\u00a0\u00a0Key fingerprint = <\/span><span style=\"font-weight: 400\">CB9E C70F 2421 AF06 7D72 \u00a0F980 8287 6A15 311B 1F84<\/span><\/p>\n<p><span style=\"font-weight: 400\">uid \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Test User &lt;test.user@address.com&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400\">sub \u00a0\u00a04096R\/8822A56A 2013-10-04<\/span><\/p>\n<p><span style=\"font-weight: 400\">This will produce a much more manageable string of numbers to compare. You can compare this string with the person themselves, or with someone else who has access to that person.<\/span><\/p>\n<p><b>Sign Their Key<\/b><\/p>\n<p><span style=\"font-weight: 400\">Signing a key tells your software that you trust the key that you have been provided with and that you have verified that it is associated with the person in question.<\/span><\/p>\n<p><span style=\"font-weight: 400\">To sign a key that you&#8217;ve imported, simply type:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;sign-key <\/span><span style=\"font-weight: 400\">email@example.com<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">When you sign the key, it means you verify that you trust the person is who they claim to be. This can help other people decide whether to trust that person too. If someone trusts you, and they see that you&#8217;ve signed this person&#8217;s key, they may be more likely to trust their identity too.<\/span><\/p>\n<p><span style=\"font-weight: 400\">You should allow the person whose key you are signing to take advantage of your trusted relationship by sending them back the signed key. You can do this by typing:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;output ~\/<\/span><span style=\"font-weight: 400\">signed.key<\/span><span style=\"font-weight: 400\"> &#8211;export &#8211;armor <\/span><span style=\"font-weight: 400\">email@example.com<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">You&#8217;ll have to type in your passphrase again. Afterwards, their public key, signed by you, will be displayed. Send them this, so that they can benefit from gaining your &#8220;stamp of approval&#8221; when interacting with others.<\/span><\/p>\n<p><span style=\"font-weight: 400\">When they receive this new, signed key, they can import it, adding the signing information you&#8217;ve generated into their GPG database. They can do this by typing:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;import ~\/<\/span><span style=\"font-weight: 400\">signed.key<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">They can now demonstrate to other people that\u00a0<\/span><i><span style=\"font-weight: 400\">you<\/span><\/i><span style=\"font-weight: 400\">\u00a0trust that their identity is correct.<\/span><\/p>\n<p><span style=\"font-weight: 400\">How To Make Your Public Key Highly Available<\/span><\/p>\n<p><span style=\"font-weight: 400\">Because of the way that public key encryption is designed, there is not anything malicious that can happen if unknown people have your public key.<\/span><\/p>\n<p><span style=\"font-weight: 400\">With this in mind, it may be beneficial to make your public key publicly available. People can then find your information to send you messages securely from your very first interaction.<\/span><\/p>\n<p><span style=\"font-weight: 400\">You can send anyone your public key by requesting it from the GPG system:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;output ~\/<\/span><span style=\"font-weight: 400\">mygpg.key<\/span><span style=\"font-weight: 400\"> &#8211;armor &#8211;export <\/span><span style=\"font-weight: 400\">your_email@address.com<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Output<\/span><\/p>\n<p><span style=\"font-weight: 400\">&#8212;&#8211;BEGIN PGP PUBLIC KEY BLOCK&#8212;&#8211;<\/span><\/p>\n<p><span style=\"font-weight: 400\">Version: GnuPG v1.4.11 (GNU\/Linux)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">mQINBFJPCuABEACiog\/sInjg0O2SqgmG1T8n9FroSTdN74uGsRMHHAOuAmGLsTse<\/span><\/p>\n<p><span style=\"font-weight: 400\">9oxeLQpN+r75Ko39RVE88dRcW710fPY0+fjSXBKhpN+raRMUKJp4AX9BJd00YA\/4<\/span><\/p>\n<p><span style=\"font-weight: 400\">EpD+8cDK4DuLlLdn1x0q41VUsznXrnMpQedRmAL9f9bL6pbLTJhaKeorTokTvdn6<\/span><\/p>\n<p><span style=\"font-weight: 400\">5VT3pb2o+jr6NETaUxd99ZG\/osPar9tNThVLIIzG1nDabcTFbMB+w7wOJuhXyTLQ<\/span><\/p>\n<p><span style=\"font-weight: 400\">JBU9xmavTM71PfV6Pkh4j1pfWImXc1D8dS+jcvKeXInBfm2XZsfOCesk12YnK3Nc<\/span><\/p>\n<p><span style=\"font-weight: 400\">u1Xe1lxzSt7Cegum4S\/YuxmYoh462oGZ7FA4Cr2lvAPVpO9zmgQ8JITXiqYg2wB3<\/span><\/p>\n<p><span style=\"font-weight: 400\">. . .<\/span><\/p>\n<p><span style=\"font-weight: 400\">You can then send this file to the other party over an appropriate medium.<\/span><\/p>\n<p><span style=\"font-weight: 400\">If you want to publish your key to a key server, you can do it manually through the forms available on most of the server sites.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Another option is to do this through the GPG interface. Look up your key ID by typing:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;list-keys <\/span><span style=\"font-weight: 400\">your_email@address.com<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">The highlighted portion in the output below is the key ID (look for the\u00a0<\/span><span style=\"font-weight: 400\">pub<\/span><span style=\"font-weight: 400\">\u00a0along the left-hand column if you&#8217;re uncertain about which one to use). It is a short way to reference the key to the internal software.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Output<\/span><\/p>\n<p><span style=\"font-weight: 400\">pub \u00a0\u00a04096R\/<\/span><span style=\"font-weight: 400\">311B1F84<\/span><span style=\"font-weight: 400\"> 2013-10-04<\/span><\/p>\n<p><span style=\"font-weight: 400\">uid \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Test User &lt;test.user@address.com&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400\">sub \u00a0\u00a04096R\/8822A56A 2013-10-04<\/span><\/p>\n<p><span style=\"font-weight: 400\">To upload your key to a certain key server, you can then use this syntax:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;send-keys &#8211;keyserver pgp.mit.edu <\/span><span style=\"font-weight: 400\">key_id<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">The key will be uploaded to the specified server. Afterwards, it will likely be distributed to other key servers around the world.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Encrypt and Decrypt Messages with GPG<\/span><\/p>\n<p><span style=\"font-weight: 400\">You can easily encrypt and decrypt messages after you have shared your keys with the other party.<\/span><\/p>\n<p><b>Encrypt Messages<\/b><\/p>\n<p><span style=\"font-weight: 400\">You can encrypt messages using the &#8220;&#8211;encrypt&#8221; flag for GPG. The basic syntax would be:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;encrypt &#8211;sign &#8211;armor -r <\/span><span style=\"font-weight: 400\">person@email.com<\/span> <span style=\"font-weight: 400\">name_of_file<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">This encrypts the message using the recipient&#8217;s public key, signs it with your own private key to guarantee that it is coming from you, and outputs the message in a text format instead of raw bytes. The filename will be the same as the input filename, but with an\u00a0<\/span><span style=\"font-weight: 400\">.asc<\/span><span style=\"font-weight: 400\">\u00a0extension.<\/span><\/p>\n<p><span style=\"font-weight: 400\">You should include a second &#8220;-r&#8221; recipient with your own email address if you want to be able to read the encrypted message. This is because the message will be encrypted with each person&#8217;s public key, and will only be able to be decrypted with the associated private key.<\/span><\/p>\n<p><span style=\"font-weight: 400\">So if it was only encrypted with the other party&#8217;s public key, you would not be able to view the message again, unless you somehow obtained their private key. Adding yourself as a second recipient encrypts the message two separate times, one for each recipient.<\/span><\/p>\n<p><b>Decrypt Messages<\/b><\/p>\n<p><span style=\"font-weight: 400\">When you receive a message, simply call GPG on the message file:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg <\/span><span style=\"font-weight: 400\">file_name<\/span><span style=\"font-weight: 400\">.asc<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">The software will prompt you as necessary.<\/span><\/p>\n<p><span style=\"font-weight: 400\">If instead of a file, you have the message as a raw text stream, you can copy and paste it after typing\u00a0<\/span><span style=\"font-weight: 400\">gpg<\/span><span style=\"font-weight: 400\">without any arguments. You can press &#8220;CTRL-D&#8221; to signify the end of the message and GPG will decrypt it for you.<\/span><\/p>\n<p><span style=\"font-weight: 400\"> How to do key maintenance <\/span><\/p>\n<p><span style=\"font-weight: 400\">There are a number of procedures that you may need to use on a regular basis to manage your key database.<\/span><\/p>\n<p><span style=\"font-weight: 400\">To list your available GPG keys that you have from other people, you can issue this command:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;list-keys<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Your key information can become outdated if you are relying on information pulled from public key servers. You do not want to be relying on revoked keys, because that would mean you are trusting potentially compromised keys.<\/span><\/p>\n<p><span style=\"font-weight: 400\">You can update the key information by issuing:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;refresh-keys<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">This will fetch new information from the key servers.<\/span><\/p>\n<p><span style=\"font-weight: 400\">You can pull information from a specific key server by using:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">gpg &#8211;keyserver <\/span><span style=\"font-weight: 400\">key_server<\/span><span style=\"font-weight: 400\"> &#8211;refresh-keys<\/span><\/li>\n<li style=\"font-weight: 400\"><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">You may receive error messages if any of your keys cannot be found on the key server.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Conclusion<\/span><\/p>\n<p><span style=\"font-weight: 400\">If the GPG is used properly then your communication with other peoples will be secure. It is extremely helpful to its user as it makes their work more secure for them, and it especially helpful to those who share their sensitive information.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Because of the way that certain encrypted communications can be flagged by monitoring programs, it is recommended to use encryption for everything, not just &#8220;secret&#8221; data. That will make it more difficult for people to know when you are sending important data or just sending a friendly hello.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction GNU Privacy Guard it\u2019s also known as GPG it is a public key cryptography implementation. It is very helpful for transferring secure of information between parties, it\u2019s also used for verifying that the message\u2019s origin is genuine or not. In the following tutorial, use will know how to work<\/p>\n","protected":false},"author":3,"featured_media":970,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-960","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news-announcements"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/06\/free-encryption.jpg?fit=700%2C479&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7ISfL-fu","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":3166,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-docker-engine-on-ubuntu\/","url_meta":{"origin":960,"position":0},"title":"How to Install Docker Engine on Ubuntu","author":"George B.","date":"April 5, 2023","format":false,"excerpt":"What is Docker Engine? Docker Engine is an open-source client-server technology that builds and runs containers using Docker components and services. It acts as a containerization technology that allows users to interact with the Docker daemon through the Docker Engine API. Docker Engine has a declarative model that automatically adjusts\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/How-to-Install-Docker-Engine-on-Ubuntu.png?fit=600%2C340&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/How-to-Install-Docker-Engine-on-Ubuntu.png?fit=600%2C340&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/How-to-Install-Docker-Engine-on-Ubuntu.png?fit=600%2C340&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":2296,"url":"https:\/\/www.virtono.com\/community\/knowledgebase\/docker-installation\/","url_meta":{"origin":960,"position":1},"title":"Docker Installation","author":"Shreyash Sharma","date":"March 8, 2021","format":false,"excerpt":"I suggest you get machine to follow along this part. So here's a little plug of our own: Cloud VPS, for as little as \u20ac2.95 a month. This article is a part of our complete series of articles on Docker. Click here to access the Free Series. While Docker was\u2026","rel":"","context":"In &quot;Knowledgebase&quot;","block_context":{"text":"Knowledgebase","link":"https:\/\/www.virtono.com\/community\/category\/knowledgebase\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2021\/03\/12122013Docker_twitter.png?fit=750%2C375&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2021\/03\/12122013Docker_twitter.png?fit=750%2C375&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2021\/03\/12122013Docker_twitter.png?fit=750%2C375&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2021\/03\/12122013Docker_twitter.png?fit=750%2C375&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3195,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/install-elasticsearch-with-kibana-and-logstash-on-ubuntu\/","url_meta":{"origin":960,"position":2},"title":"Install Elasticsearch with Kibana and Logstash on Ubuntu","author":"George B.","date":"April 9, 2023","format":false,"excerpt":"Elasticsearch is an open-source, distributed search and analytics engine that is designed to handle large amounts of data. It is built on top of the Apache Lucene search engine library and is part of the Elastic Stack (formerly known as the ELK Stack), which includes Kibana and Logstash. It comes\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/How-to-install-Elasticsearch-with-Kibana-and-Logstash-on-Ubuntu.png?fit=600%2C330&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/How-to-install-Elasticsearch-with-Kibana-and-Logstash-on-Ubuntu.png?fit=600%2C330&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/04\/How-to-install-Elasticsearch-with-Kibana-and-Logstash-on-Ubuntu.png?fit=600%2C330&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":2759,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/froxlor-on-ubuntu-20\/","url_meta":{"origin":960,"position":3},"title":"Install Froxlor on Ubuntu 20.04","author":"George B.","date":"July 14, 2022","format":false,"excerpt":"What is Froxlor? Froxlor: The server administration software for your needs. Lightweight and fast - manage customers, IPs, domains, SSL, emails, databases, FTP accounts, and more. Froxlor installation and configuration for Ubuntu 20.04 Step 1 - Install the requirements on your server using the apt tool sudo apt -y install\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2022\/07\/1628625477276.jpeg?fit=1200%2C585&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2022\/07\/1628625477276.jpeg?fit=1200%2C585&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2022\/07\/1628625477276.jpeg?fit=1200%2C585&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2022\/07\/1628625477276.jpeg?fit=1200%2C585&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2022\/07\/1628625477276.jpeg?fit=1200%2C585&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":1067,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-mongodb-on-ubuntu-16-04\/","url_meta":{"origin":960,"position":4},"title":"How to Install MongoDB on Ubuntu 16.04","author":"Shreyash Sharma","date":"October 9, 2017","format":false,"excerpt":"Introduction MongoDB it is a document-oriented database. It is a free and open-source database. It does not rely on a traditional table-based relational database structure that\u2019s why it is classified as a NoSQL database. Instead it uses JSON-like documents with dynamic schemas. Before you add data to database MongoDB does\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/10\/mongodb-1.jpeg?fit=1040%2C560&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/10\/mongodb-1.jpeg?fit=1040%2C560&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/10\/mongodb-1.jpeg?fit=1040%2C560&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2017\/10\/mongodb-1.jpeg?fit=1040%2C560&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":517,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/install-nginx-stack-on-centos\/","url_meta":{"origin":960,"position":5},"title":"INSTALL NGINX STACK ON CENTOS","author":"Daniel Draga","date":"August 25, 2016","format":false,"excerpt":"What is Nginx?\u00a0Nginx is a better free alternative to Apache because its lightweight and RAM-friendly. It can perform better and faster than Apache, particularly when the\u00a0number\u00a0of concurrent site visitors is on the rise. The only downside of Nginx is that not many users familiar with Nginx because it has different\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"1","src":"https:\/\/i0.wp.com\/community.virtono.com\/wp-content\/uploads\/2016\/08\/1-10-300x44.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/comments?post=960"}],"version-history":[{"count":1,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/960\/revisions"}],"predecessor-version":[{"id":961,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/960\/revisions\/961"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media\/970"}],"wp:attachment":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media?parent=960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/categories?post=960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/tags?post=960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}