{"id":1510,"date":"2023-03-25T14:01:25","date_gmt":"2023-03-25T06:01:25","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1510"},"modified":"2023-04-28T20:21:24","modified_gmt":"2023-04-28T12:21:24","slug":"basic-usage-record-of-gnupg","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/basic-usage-record-of-gnupg\/","title":{"rendered":"GnuPG\u57fa\u672c\u4f7f\u7528\u8bb0\u5f55"},"content":{"rendered":"<p>GnuPG\u5b98\u7f51\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/www.gnupg.org\/\">https:\/\/www.gnupg.org\/<\/a><\/p>\n<h2>\u751f\u6210\u5bc6\u94a5\u5bf9<\/h2>\n<pre><code>$ gpg2 --gen-key<\/code><\/pre>\n<p><!-- more --><\/p>\n<h2>\u67e5\u770b\u79d8\u94a5\u5bf9<\/h2>\n<pre><code>$ gpg -K\n\/home\/yezhou\/.gnupg\/secring.gpg\n------------------------------\nsec   2048R\/F92033F1 2020-05-22\nuid                  yezhou_me_prod_pbk (production) &lt;yezhou@yezhou.me&gt;\nssb   2048R\/8651EC78 2020-05-22<\/code><\/pre>\n<h2>\u5bfc\u51fa\u516c\u94a5<\/h2>\n<pre><code>$ gpg2 -a -o gpg-public-production.key --export F92033F1<\/code><\/pre>\n<h2>\u5bfc\u51fa\u79c1\u94a5<\/h2>\n<pre><code>$ gpg2 -a -o gpg-private-production.key --export-secret-keys F92033F1<\/code><\/pre>\n<h2>\u5bfc\u5165\u516c\u94a5<\/h2>\n<pre><code>$ gpg2 --import [\u5bc6\u94a5\u6587\u4ef6]<\/code><\/pre>\n<pre><code>$ gpg2 --import gpg-public-production.key\ngpg: key 58D2BC18: public key &quot;yezhou_me_prod_pbk &lt;yezhou@yezhou.me&gt;&quot; imported\ngpg: Total number processed: 1\ngpg:               imported: 1  (RSA: 1)<\/code><\/pre>\n<h2>\u8bbe\u7f6e\u5bc6\u94a5\u4fe1\u4efb\u5ea6<\/h2>\n<pre><code>$ gpg2 --edit-key [\u5bfc\u5165\u5bc6\u94a5\u7684ID]<\/code><\/pre>\n<pre><code>$ gpg --edit-key yezhou_me_prod_pbk\n\ngpg&gt; trust<\/code><\/pre>\n<h2>\u79d8\u94a5\u5217\u8868<\/h2>\n<pre><code>$ gpg2 --list-keys<\/code><\/pre>\n<h2>\u52a0\u5bc6\u6587\u4ef6<\/h2>\n<pre><code>$ gpg2 -r \u7528\u6237ID -o destfile -e sourcefile<\/code><\/pre>\n<ul>\n<li><code>-r<\/code> \u7528\u6237ID\uff0c\u6307\u5b9a\u7528\u6237ID\u5373\u6307\u5b9a\u7528\u6765\u52a0\u5bc6\u7684\u516c\u94a5<\/li>\n<li><code>-o<\/code> destfile\uff0c&quot;destfile&quot;\u52a0\u5bc6\u8f93\u51fa\u7684\u6587\u4ef6<\/li>\n<li><code>-e<\/code> sourcefile\uff0c&quot;sourcefile&quot;\u662f\u5f85\u52a0\u5bc6\u7684\u6587\u4ef6<\/li>\n<\/ul>\n<h2>\u89e3\u5bc6\u4fe1\u606f<\/h2>\n<pre><code>$ gpg2 -o destfile -d sourcefile<\/code><\/pre>\n<h2>\u7075\u6d3b\u52a0\u89e3\u5bc6<\/h2>\n<p>\u5982\u4f55\u66f4\u65b9\u4fbf\u7684\u52a0\u89e3\u5bc6\uff0c\u4f8b\u5982\u6536\u53d1\u90ae\u4ef6\u65f6<\/p>\n<p>\u9700\u8981\u66f4\u591a\u5de5\u5177\u652f\u6301\u3002\u53ef\u7f51\u4e0a\u641c\u7d22\uff0c\u6216\u770b\u770b\u8fd9\u4e2a\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/gpgtools.org\/\">https:\/\/gpgtools.org\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GnuPG\u5b98\u7f51\uff1ahttps:\/\/www.gnupg.org\/ \u751f\u6210\u5bc6\u94a5\u5bf9 $ gpg2 &#8211;gen-key \u67e5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[97],"tags":[369],"class_list":["post-1510","post","type-post","status-publish","format-standard","hentry","category-tools-skills","tag-gpg"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1510"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1510\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}