{"id":2463,"date":"2023-10-28T11:58:43","date_gmt":"2023-10-28T09:58:43","guid":{"rendered":"https:\/\/labalec.fr\/erwan\/?p=2463"},"modified":"2023-10-29T14:09:48","modified_gmt":"2023-10-29T13:09:48","slug":"lets-play-with-gpg","status":"publish","type":"post","link":"https:\/\/labalec.fr\/erwan\/?p=2463","title":{"rendered":"Lets play with GPG"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2023\/10\/2023-10-28-11_47_20-What-is-a-PGP-File_-PGP-File-Encryption-and-Decryption-_-GoAnywhere-MFT.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2023\/10\/2023-10-28-11_47_20-What-is-a-PGP-File_-PGP-File-Encryption-and-Decryption-_-GoAnywhere-MFT.png\" alt=\"\" class=\"wp-image-2464\" width=\"513\" height=\"448\" srcset=\"https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2023\/10\/2023-10-28-11_47_20-What-is-a-PGP-File_-PGP-File-Encryption-and-Decryption-_-GoAnywhere-MFT.png 957w, https:\/\/labalec.fr\/erwan\/wp-content\/uploads\/2023\/10\/2023-10-28-11_47_20-What-is-a-PGP-File_-PGP-File-Encryption-and-Decryption-_-GoAnywhere-MFT-300x263.png 300w\" sizes=\"auto, (max-width: 513px) 100vw, 513px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><span style=\"text-decoration: underline;\">On both hosts: <\/span><\/p>\n\n\n\n<p>Install GPG (download from <a rel=\"noreferrer noopener\" href=\"https:\/\/www.gnupg.org\/ftp\/gcrypt\/binary\/gnupg-w32-2.4.3_20230704.exe\" target=\"_blank\">here<\/a>)<\/p>\n\n\n\n<p>Generate a key pair : <strong>gpg &#8211;gen-key<\/strong><\/p>\n\n\n\n<p>List your public keys : <strong>gpg &#8211;list-keys<\/strong> (optional)<\/p>\n\n\n\n<p>List your secret\/private keys : <strong>gpg &#8211;list-secret-keys<\/strong> (optional)<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><span style=\"text-decoration: underline;\">On the host encrypting (aka the source):<\/span><\/p>\n\n\n\n<p>Import your target key (i.e from the host that will decrypt) : <strong>gpg &#8211;import target.key<\/strong><\/p>\n\n\n\n<p>Ensure that you have the public key of the target in your trust store : <strong>gpg &#8211;list-keys<\/strong><\/p>\n\n\n\n<p>Encrypt your file with the target public key : <strong>gpg -e -r target message.txt<\/strong> (or <strong>gpg &#8211;always-trust -e -r target message.txt<\/strong> if you dont want to be bothered by the public key not being trusted)<\/p>\n\n\n\n<p>note : more details <a href=\"https:\/\/stackoverflow.com\/questions\/9460140\/gpg-encrypt-file-without-keyboard-interaction\" target=\"_blank\" rel=\"noreferrer noopener\">here <\/a>about user interaction.<\/p>\n\n\n\n<p><span style=\"text-decoration: underline;\">On the host decrypting (aka the target):<\/span><\/p>\n\n\n\n<p>Export your public key : <strong>gpg &#8211;export &gt; target.key<\/strong> (to be shared with the source host encrypting)<\/p>\n\n\n\n<p>Decrypt the file with the secret\/private key : <strong>gpg message.txt.gpg<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>On both hosts: Install GPG (download from here) Generate a key pair : gpg &#8211;gen-key List your public keys : gpg &#8211;list-keys (optional) List your secret\/private keys : gpg &#8211;list-secret-keys (optional) On the host encrypting (aka the source): Import your target key (i.e from the host that will decrypt) : gpg &#8211;import target.key Ensure that <a href='https:\/\/labalec.fr\/erwan\/?p=2463' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[140,139],"class_list":["post-2463","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-gpg","tag-pgp","category-1-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2463"}],"version-history":[{"count":5,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2463\/revisions"}],"predecessor-version":[{"id":2472,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2463\/revisions\/2472"}],"wp:attachment":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}