{"id":692,"date":"2018-03-07T19:18:34","date_gmt":"2018-03-07T11:18:34","guid":{"rendered":"https:\/\/www.datarelab.com\/blog\/?p=692"},"modified":"2018-03-07T19:18:34","modified_gmt":"2018-03-07T11:18:34","slug":"gnupg-%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.datarelab.com\/blog\/Technical_literature\/692.html","title":{"rendered":"GnuPG \u4f7f\u7528"},"content":{"rendered":"<p>\u5f00\u59cb\u4f7f\u7528<br \/>\n\u751f\u6210\u5bc6\u94a5<br \/>\nGnuPG \u4f7f\u7528\u516c\u94a5\u6765\u8fdb\u884c\u52a0\u5bc6\uff0c\u4f7f\u7528\u79c1\u94a5\u6765\u89e3\u5bc6\u3002<\/p>\n<p>gpg \u2013gen-key<br \/>\n\u5b83\u7528\u6765\u751f\u6210\u4f60\u7684\u5bc6\u94a5\uff1a\u6d41\u7a0b\u5982\u4e0b:<\/p>\n<p>[11:26:12] emacsist:~ $ gpg --gen-key<br \/>\ngpg (GnuPG) 2.0.30; Copyright (C) 2015 Free Software Foundation, Inc.<br \/>\nThis is free software: you are free to change and redistribute it.<br \/>\nThere is NO WARRANTY, to the extent permitted by law.<br \/>\n# \u4f7f\u7528\u54ea\u79cd\u7c7b\u578b\u7684\u5bc6\u94a5\uff08\u9ed8\u8ba4\u7684\u5c31\u591f\u4e86\uff09<br \/>\nPlease select what kind of key you want:<br \/>\n   (1) RSA and RSA (default)<br \/>\n   (2) DSA and Elgamal<br \/>\n   (3) DSA (sign only)<br \/>\n   (4) RSA (sign only)<br \/>\nYour selection? 1<br \/>\nRSA keys may be between 1024 and 4096 bits long.<br \/>\n# \u5bc6\u94a5\u7684\u957f\u5ea6<br \/>\nWhat keysize do you want? (2048) 2048<br \/>\nRequested keysize is 2048 bits<br \/>\n# \u5bc6\u94a5\u6709\u6548\u671f\uff08\u9ed8\u8ba4\u4e3a\u6c38\u4e0d\u8fc7\u671f\uff0c\u9ed8\u8ba4\u7684\u4e5f\u591f\u4e86\uff09<br \/>\nPlease specify how long the key should be valid.<br \/>\n         0 = key does not expire<br \/>\n      <n>  = key expires in n days<br \/>\n      <n>w = key expires in n weeks<br \/>\n      <n>m = key expires in n months<br \/>\n      <n>y = key expires in n years<br \/>\nKey is valid for? (0) 0<br \/>\nKey does not expire at all<br \/>\n# \u4ee5\u4e0a\u4fe1\u606f\u662f\u5426\u6b63\u786e<br \/>\nIs this correct? (y\/N) y<\/p>\n<p>GnuPG needs to construct a user ID to identify your key.<br \/>\n# \u4f60\u7684\u771f\u5b9e\u540d<br \/>\nReal name: emacsist<br \/>\n# \u4f60\u7684\u90ae\u7bb1<br \/>\nEmail address: emacsist@qq.com<br \/>\n# \u5907\u6ce8<br \/>\nComment:<br \/>\nYou selected this USER-ID:<br \/>\n    \"emacsist <emacsist@qq.com>\"<\/p>\n<p># \u662f\u5426\u8981\u4fee\u6539\u540d\u5b57\uff0c\u5907\u6ce8\uff0c\u90ae\u7bb1\u6216OK\u3001\u9000\u51fa\uff1f<br \/>\nChange (N)ame, (C)omment, (E)mail or (O)kay\/(Q)uit? O<br \/>\nYou need a Passphrase to protect your secret key.<\/p>\n<p># \u4ee5\u4e0a\u6b65\u9aa4\u5b8c\u6210\u540e\uff0c\u5c31\u8981\u8f93\u5165\u4fdd\u62a4\u79c1\u94a5\u7684\u5bc6\u7801\u4e86\uff0c\u8fd9\u4e2a\u4e5f\u662f\u6574\u4e2aGnuPG\u6700\u8106\u5f31\u7684\u73af\u8282<br \/>\n\u5bc6\u94a5\u7684\u5e9f\u9664<br \/>\n\u5982\u679c\u4f60\u5fd8\u8bb0\u4e86\u79c1\u94a5\u7684\u4fdd\u62a4\u5bc6\u7801\u6216\u8005\u4e22\u5931\u4e86\u79c1\u94a5\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u6765\u53d1\u5e03\u901a\u77e5\uff0c\u8ba9\u5176\u4ed6\u4eba\u77e5\u9053\u8be5\u516c\u94a5\u5df2\u7ecf\u4e0d\u518d\u4f1a\u4f7f\u7528\uff1a<\/p>\n<p>gpg --output revoke.asc --gen-revoke emacsist@qq.com<br \/>\n\u8fd9\u4e2a\u8981\u5728\u786e\u8ba4\u4f60\u7684\u5bc6\u94a5\u65e0\u6548\u4e86\u7684\u60c5\u51b5\u4e0b\u624d\u516c\u5e03\u8fd9\u4e2a\u8bc1\u4e66\uff0c\u5728\u6b64\u4e4b\u524d\uff0c\u8981\u786e\u4fdd\u5176\u4ed6\u4eba\u8bbf\u95ee\u4e0d\u4e86\u8fd9\u4e2a\u8bc1\u4e66\uff0c\u5426\u5219\u5176\u4ed6\u4eba\u4e5f\u53ef\u4ee5\u53d1\u5e03\u8fd9\u4e2a\u8bc1\u4e66\u7136\u540e\u8ba9\u4f60\u7684\u516c\u94a5\u5931\u6548\u3002<\/p>\n<p>\u4ea4\u6362\u5bc6\u94a5<br \/>\n\u5bfc\u51fa\u516c\u94a5<br \/>\n\u4e3a\u4e86\u53d1\u9001\u4f60\u7684\u516c\u94a5\u7ed9\u5176\u4ed6\u4eba\uff0c\u9996\u5148\u4f60\u8981\u5bfc\u51fa\u5b83\u3002<\/p>\n<p>gpg --output emacsist.gpg --export emacsist@qq.com<br \/>\n\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5bfc\u51fa\u7684\u662f\u4e8c\u8fdb\u5236\u683c\u5f0f\u7684\u3002GnuPG \u652f\u6301\u4e00\u4e2a\u9009\u9879\uff1a \u2013armor \u5b83\u53ef\u4ee5\u5bfc\u51fa\u4e3a ASCII \u683c\u5f0f\u3002\u5728\u4efb\u4f55\u5bfc\u51fa\u7684\u9009\u9879\u4e2d\uff0c\u90fd\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u6765\u6307\u5b9a\u5bfc\u51fa\u4e3a ASCII \u683c\u5f0f\u3002<\/p>\n<p>\u5217\u51fa\u516c\u5bc6\u94a5<br \/>\ngpg --list-keys<br \/>\n\u5bfc\u5165\u516c\u94a5<br \/>\ngpg --import emacsist.gpg<br \/>\n\u5220\u9664\u67d0\u4e2a\u516c\u94a5<br \/>\ngpg --delete-key emacsist@qq.com<br \/>\n\u9a8c\u8bc1\u516c\u94a5<br \/>\n\u4e00\u65e6\u5bfc\u5165\u4e86\u4e00\u4e2a\u516c\u94a5\uff0c\u5c31\u9700\u8981\u53bb\u8fdb\u884c\u9a8c\u8bc1\u5b83\u4e86<\/p>\n<p>[11:56:22] emacsist:\/tmp $ gpg --edit-key emacsist@qq.co<br \/>\ngpg (GnuPG) 2.0.30; Copyright (C) 2015 Free Software Foundation, Inc.<br \/>\nThis is free software: you are free to change and redistribute it.<br \/>\nThere is NO WARRANTY, to the extent permitted by law.<\/p>\n<p>Secret key is available.<\/p>\n<p>pub  2048R\/2E67BCA8  created: 2017-03-29  expires: never       usage: SC<br \/>\ntrust: ultimate      validity: ultimate<br \/>\nsub  2048R\/FCB22855  created: 2017-03-29  expires: never       usage: E<br \/>\n[ultimate] (1). emacsist <emacsist@qq.com><\/p>\n<p>gpg> fpr<br \/>\npub   2048R\/2E67BCA8 2017-03-29 emacsist <emacsist@qq.com><br \/>\nPrimary key fingerprint: B698 23B4 571F 98EE CEDA  59C9 2B07 0A29 2E67 BCA8<\/p>\n<p>gpg><br \/>\nfpr \u5c31\u4f1a\u6253\u5370\u51fa\u8be5\u5bc6\u94a5\u7684\u6307\u7eb9\uff0c\u7136\u540e\u518d\u901a\u8fc7\u62e5\u6709\u8005\u7684\u7535\u8bdd\uff0c\u6216\u8005email\uff08\u6216\u5176\u4ed6\u4efb\u4f55\u65b9\u5f0f\uff0c\u53ea\u8981\u4f60\u80fd\u4fdd\u8bc1\u4ed6\u662f\u8be5\u5bc6\u94a5\u7684\u771f\u5b9e\u62e5\u6709\u8005\u5373\u53ef\uff09\uff0c\u7136\u540e\u8ba9\u5bc6\u94a5\u62e5\u6709\u8005\u5c06\u5b83\u7684\u5bc6\u94a5\u6307\u7eb9\u53d1\u7ed9\u4f60\uff0c\u7136\u540e\u518d\u8fdb\u884c\u4e8c\u8005\u5bf9\u6bd4\uff0c\u9a8c\u8bc1\u662f\u5426\u4e00\u81f4\u5373\u53ef\u3002<\/p>\n<p>\u68c0\u6d4b\u5b8c\u5bc6\u94a5\u7684\u6307\u7eb9\u540e\uff0c\u5c31\u53ef\u4ee5\u8fdb\u884c\u7b7e\u540d\u8ba4\u8bc1\u5b83\u4e86\u3002\u5728\u4e0a\u9762\u540e\u7eed\u547d\u4ee4\u4e2d\uff0c\u8f93\u5165 sign \u5373\u53ef\u3002<\/p>\n<p>\u5bfc\u51fa\u79c1\u94a5<br \/>\ngpg --output emacsist@qq.com.private.key --export-secret-keys emacsist@qq.com<br \/>\n\u5bfc\u5165\u79c1\u94a5<br \/>\ngpg --allow-secret-key-import --import emacsist@qq.com.private.key<br \/>\n\u5217\u51fa\u79c1\u94a5<br \/>\ngpg --list-secret-keys<br \/>\n\u5220\u9664\u4e00\u4e2a\u79c1\u94a5:<br \/>\ngpg --delete-secret-key emacsist@qq.com<br \/>\n\u4fe1\u4efb\u5bc6\u94a5<br \/>\ngpg -edit-key emacsist@qq.com<br \/>\n\u7136\u540e\u8f93\u5165 trust \u6ce8\u610f\uff0c\u6b64\u65f6\u8981\u5c06\u76f8\u5e94\u7684 gpg \u8fdb\u7a0b\u9000\u51fa\u540e\u624d\u80fd\u91cd\u65b0\u751f\u6548\u3002\u4e0d\u7136\uff0c\u8fd8\u4f1a\u62a5 untrust \u7684\u8b66\u544a\u3002<\/p>\n<p>\u52a0\u89e3\u5bc6\u6587\u6863<br \/>\n\u52a0\u5bc6\u6587\u6863<br \/>\n\u4f7f\u7528\u516c\u94a5\u6765\u8fdb\u884c\u52a0\u5bc6<br \/>\ngpg --output hello.txt.gpg --encrypt --recipient emacsist@qq.com hello.txt<br \/>\n\u2013recipient \u53ef\u4ee5\u6709\u591a\u4e2a\u540c\u540d\u9009\u9879\u6765\u5206\u522b\u6307\u5b9a\u4e0d\u540c\u7684\u516c\u94a5\uff0c\u52a0\u5bc6\u540e\u7684\u6587\u6863\uff0c\u53ea\u80fd\u7528\u8fd9\u4e9b\u516c\u94a5\u5bf9\u5e94\u7684\u79c1\u94a5\u4e4b\u4e00\u6765\u8fdb\u884c\u89e3\u5bc6\u3002<\/p>\n<p>\u591a\u4e2a\u516c\u94a5\u7684\u8bdd\uff0c\u53ef\u4ee5\u8fd9\u6837\u5b50\u6307\u5b9a:<\/p>\n<p>gpg --output hello.txt.gpg --encrypt --recipient emacsist@qqcom --recipient emacsist1@qq.com hello.txt<br \/>\n\u7279\u522b\u5730\uff0c\u4f60\u81ea\u5df1\u5e76\u4e0d\u80fd\u89e3\u5bc6\u4f60\u52a0\u5bc6\u540e\u7684\u6587\u6863\uff0c\u9664\u975e\u4f60\u5c06\u4f60\u81ea\u5df1\u7684\u516c\u94a5\u4e0e\u5199\u5728\u4e86 \u2013recipient \u5217\u8868\u4e2d<\/p>\n<p>\u4f7f\u7528\u5bf9\u79f0\u5bc6\u7801\u6765\u8fdb\u884c\u52a0\u5bc6<br \/>\ngpg --output hello.symmetric.gpg.txt --symmetric hello.txt<br \/>\n\u56de\u8f66\u540e\uff0c\u5b83\u4f1a\u8981\u6c42\u4f60\u8f93\u5165\u5bc6\u7801\u6765\u4fdd\u62a4\u8fd9\u4e2a\u6587\u6863\uff0c\u6ce8\u610f\uff0c\u8fd9\u4e2a\u5bc6\u7801\uff0c\u5e76\u4e0d\u662f\u90a3\u4e2a\u4fdd\u62a4\u79c1\u94a5\u7684\u5bc6\u7801\uff0c\u4e5f\u4e0d\u8981\u4e0e\u4fdd\u62a4\u79c1\u94a5\u7684\u5bc6\u7801\u76f8\u540c\u3002\u8fd9\u4e2a\u5728\u89e3\u5bc6\u65f6\uff0c\u4e5f\u9700\u8981\u8f93\u5165\u540c\u6837\u7684\u6587\u6863\u5bc6\u7801\u6765\u8fdb\u884c\u89e3\u5bc6\u3002\u8fd9\u4e00\u822c\u7528\u5728\u4e0d\u9700\u8981\u4e0e\u5176\u4ed6\u4eba\u8fdb\u884c\u901a\u4fe1\u65f6\u4f7f\u7528\u7684\u52a0\u5bc6\u65b9\u5f0f\u3002<\/p>\n<p>\u89e3\u5bc6\u6587\u6863<br \/>\n\u89e3\u5bc6\u4f7f\u7528\u516c\u94a5\u6765\u8fdb\u884c\u52a0\u5bc6\u7684\u6587\u6863<br \/>\ngpg --output hello.decrypt.txt --decrypt hello.txt.gpg<br \/>\n\u89e3\u5bc6\u4f7f\u7528\u5bf9\u79f0\u5bc6\u7801\u6765\u8fdb\u884c\u52a0\u5bc6\u7684\u6587\u6863<br \/>\ngpg --output hello.symmetric.txt --decrypt hello.symmetric.gpg.txt<\/p>\n<p>[12:18:26] emacsist:\/tmp $ cat hello.symmetric.txt<br \/>\nHello World<br \/>\n\u6570\u5b57\u7b7e\u540d<br \/>\n\u7b7e\u540d<br \/>\n\u5b83\u662f\u4f7f\u7528\u79c1\u94a5\u6765\u521b\u5efa\uff0c\u7136\u540e\u4f7f\u7528\u516c\u94a5\u6765\u8fdb\u884c\u9a8c\u8bc1\u7684\u3002<\/p>\n<p>gpg --output hello.txt.sign --sign hello.txt<br \/>\n\u9a8c\u8bc1\u6216\u6062\u590d\u539f\u6587<br \/>\n\u7ed9\u51fa\u4e00\u4e2a\u7b7e\u540d\u7684\u6587\u6863\uff0c\u4f60\u53ef\u4ee5\u9a8c\u8bc1\u5b83\u6216\u8005\u9a8c\u8bc1\u5e76\u6062\u590d\u539f\u6587\u3002\uff08\u56e0\u4e3a\u7b7e\u540d\u540e\u7684\u5185\u5bb9\u662f\u538b\u7f29\u7684\uff0c\u5e76\u4e14\u662f\u4e8c\u8fdb\u5236\u683c\u5f0f\u7684\uff09<\/p>\n<p>\u4ec5\u9a8c\u8bc1<br \/>\ngpg --verify hello.txt.sign<br \/>\n\u9a8c\u8bc1\u548c\u6062\u590d<br \/>\ngpg --output hello.sig.txt --decrypt hello.txt.sign<br \/>\n\u7b7e\u540d\u4f46\u5e76\u4e0d\u538b\u7f29\u6587\u6863<br \/>\n\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528 \u2013sign \u4f1a\u8fdb\u884c\u7b7e\u540d\u5e76\u538b\u7f29\u6587\u6863\u3002 \u4f46\u4e5f\u53ef\u4ee5\u4f7f\u7528 \u2013clearsign \u9009\u9879\uff0c\u6765\u5c06\u6587\u6863\u548c\u7b7e\u540d\u5206\u5f00\u663e\u793a\u3002\u4f8b\u5982:<\/p>\n<p>gpg --output hello.sign --clearsign hello.txt<br \/>\n\u5b83\u7684\u8f93\u51fa\u5982\u4e0b:<\/p>\n<p>[12:36:42] emacsist:\/tmp $ cat hello.sign<br \/>\n-----BEGIN PGP SIGNED MESSAGE-----<br \/>\nHash: SHA256<\/p>\n<p>Hello World<br \/>\n-----BEGIN PGP SIGNATURE-----<br \/>\nVersion: GnuPG v2<\/p>\n<p>iQEcBAEBCAAGBQJY3ItWAAoJECsHCikuZ7yo7rwH\/1mfxVtxXexHsnKamR434Fjt<br \/>\njjhIy27PajVecm7byyHLHrBCP\/meDk4jl+wDDPpE8+0FJE17M8opW1YFZUzUXj52<br \/>\nbG+0kLZNtuIn2f3ybbsXGfcvmxo4n7B7jvDHJBqHDS8OMoc2nfUurN\/XbYO10Mm3<br \/>\nYmBoEKjxk2Q6DHU3eJlnaOWXdPhZzCt24zjCrMdkG5iZln80TMHJyxXJD63zBzB1<br \/>\ndkHpX\/vYgmy2EzDMZXBApatzSoys0\/siGlZ64jnS8m61zlWPLhpMl3haSAPk5VDx<br \/>\n+ydw\/c\/9SO3cVjTzWLmXfW3hvvN\/UW\/HDOHb1j29yUhalztI1zTtEm2VyHiKJFo=<br \/>\n=LP7m<br \/>\n-----END PGP SIGNATURE-----<br \/>\n\u53ef\u4ee5\u770b\u5230\uff0c\u4e0a\u9762\u663e\u793a\u4e86\u6587\u6863\u7684\u539f\u6587\uff0c\u4e0b\u9762\u663e\u793a\u4e86\u6587\u6863\u7684\u7b7e\u540d\u3002<\/p>\n<p>\u5206\u5f00\u7b7e\u540d<br \/>\ngpg --output hello.detached.sign.txt --detach-sign hello.txt<br \/>\n\u8fd9\u6837\u5b50\u7b7e\u540d\u540e\uff0c\u9700\u8981\u540c\u65f6\u9a8c\u8bc1\u539f\u6587\u4ef6\u548c\u7b7e\u540d\u6587\u4ef6\uff0c\u7528\u9009\u9879\uff1a \u2013verify :<\/p>\n<p>[12:40:37] emacsist:\/tmp $ gpg --verify hello.detached.sign.txt hello.txt<br \/>\ngpg: Signature made Thu Mar 30 12:40:28 2017 CST using RSA key ID 2E67BCA8<br \/>\ngpg: Good signature from \"emacsist <emacsist@qq.com>\" [ultimate]<br \/>\n\u6ca1\u95ee\u9898\u7684\u8bdd\uff0c\u5b83\u4f1a\u62a5\u544a: Good signature<\/p>\n<p>\u6982\u5ff5<br \/>\nGnuPG \u4f7f\u7528\u51e0\u79cd\u52a0\u5bc6\u65b9\u5f0f:<\/p>\n<p>\u5bf9\u79f0\u52a0\u5bc6<br \/>\n\u4f7f\u7528\u540c\u6837\u7684 key \u6765\u8fdb\u884c\u52a0\u89e3\u5bc6\uff0c\u4f8b\u5b50\u6709: 3DES , Blowfish , \u4ee5\u53ca IDEA<br \/>\n\u516c\u94a5\u52a0\u5bc6<br \/>\n\u4f7f\u7528\u5bf9\u79f0\u52a0\u5bc6\u7684\u95ee\u9898\u5e76\u4e0d\u5728\u4e8e\u5b83\u7684\u5b89\u5168\u6027\uff0c\u800c\u662f\u5728\u4ea4\u6362 key \u3002\u653b\u51fb\u8005\u5bb9\u6613\u62e6\u622a key \u5e76\u7834\u89e3\u5b83\uff1b\u53e6\u4e00\u4e2a\u95ee\u9898\u662f\u5982\u679c\u6709N\u4e2a\u4eba\u9700\u8981\u901a\u4fe1\uff0c\u5219\u5c31\u9700\u8981\u6709 n(n-1)\/2 \u4e2a key\u4e86\u3002\u8fd9\u5728\u5c0f\u8303\u56f4\u901a\u4fe1\u8fd8\u597d\uff0c\u5982\u679c\u662f\u4e0e\u5927\u91cf\u7684\u4eba\u8fdb\u884c\u8fd9\u6837\u5b50\u7684\u901a\u4fe1\uff0c\u5c31\u4e0d\u662f\u4e00\u4e2a\u660e\u667a\u7684\u9009\u62e9\u4e86\u3002 \u516c\u94a5\u52a0\u5bc6\u5c31\u662f\u7528\u6765\u907f\u4ea4\u6362 key \u7684\u95ee\u9898\u7684\u3002\u516c\u94a5\u7528\u6765\u8fdb\u884c\u52a0\u5bc6\uff0c\u79c1\u94a5\u6765\u6765\u8fdb\u884c\u89e3\u5bc6\u3002<br \/>\n(no term)<br \/>\n\u5355\u5411\u6563\u5217<br \/>\n\u6742\u4ea4\u52a0\u5bc6<br \/>\n\u516c\u94a5\u52a0\u5bc6\u5e76\u4e0d\u662f\u4e07\u80fd\u7684\u3002\u5b83\u540c\u65f6\u4f7f\u7528\u5bf9\u79f0\u52a0\u5bc6\u548c\u516c\u94a5\u52a0\u5bc6\u3002<br \/>\n\u6570\u5b57\u7b7e\u540d<br \/>\n\u4e00\u4e2a\u54c8\u5e0c\u51fd\u6570\uff0c\u662f\u4e00\u4e2a\u591a\u5bf9\u4e00\u6620\u5c04\u7684\u51fd\u6570\u3002\u4e00\u4e2a\u6587\u6863\u7684\u6570\u5b57\u7b7e\u540d\u5c31\u662f\u5c06\u4e00\u4efd\u6587\u6863\u5e94\u7528\u5230\u4e00\u4e2a\u54c8\u5e0c\u51fd\u6570\u5f97\u51fa\u7684\u7ed3\u679c\u3002\u8fd9\u4e2a\u51fd\u6570\u8981\u6ee1\u8db3\u4ee5\u4e0b\u4e24\u4e2a\u7279\u6027\uff1a<\/p>\n<p>\u6bd4\u8f83\u56f0\u96be\u5730\u5c06\u4e24\u4efd\u4e0d\u540c\u7684\u6587\u6863\u4ea7\u751f\u51fa\u540c\u4e00\u4e2a\u503c<br \/>\n\u7ed9\u51fa\u4e00\u4e2a\u54c8\u5e0c\u503c\uff0c\u6bd4\u8f83\u56f0\u96be\u5730\u8fd8\u539f\u8be5\u6587\u6863<br \/>\n\u5bc6\u94a5\u7ba1\u7406<br \/>\n\u7be1\u6539\u5bc6\u94a5\u662f\u4e00\u4e2a\u4f7f\u7528\u516c\u94a5\u65b9\u5f0f\u7684\u4e00\u4e2a\u4e3b\u8981\u5f31\u70b9\u3002\u5728GnuPG \u4e2d\u7ba1\u7406\u5bc6\u94a5\u7684\u5173\u952e\u5c31\u662f \u7b7e\u540d\u5bc6\u94a5<\/p>\n<p>\u6bd4\u5982:<\/p>\n<p>chloe% gpg -edit-key chloe@cyb.org<br \/>\nSecret key is available.<br \/>\npub  1024D\/26B6AAE1  created: 1999-06-15 expires: never<br \/>\nsub  2048g\/0CF8CB7A  created: 1999-06-15 expires: never<br \/>\nsub  1792G\/08224617  created: 1999-06-15 expires: 2002-06-14<br \/>\nsub  960D\/B1F423E7   created: 1999-06-15 expires: 2002-06-14<br \/>\n(1)  Chloe (Jester) <chloe@cyb.org><br \/>\n(2)  Chloe (Plebian) <chloe@tel.net><br \/>\nCommand><br \/>\n\u8bf4\u660e:<\/p>\n<p>\u7b2c\u4e00\u5217<br \/>\npub \u8868\u793a\u662f master signing key \u7684\u516c\u5f00\u90e8\u5206<br \/>\n\u7b2c\u4e8c\u5217<br \/>\n\u6307\u793a\u8be5 key \u7684\u4f4d\u7684\u957f\u5ea6\uff0c\u7c7b\u578b\u4ee5\u53caID\u3002D\u8868\u793a\u7c7b\u578b\u4e3a DSA\uff1b g\u8868\u793a\u662f\u4ec5\u4e3a\u52a0\u5bc6\u7684 ElGamal key \uff1bG\u8868\u793a\u662f ElGamal key \u5b83\u53ef\u7528\u65f6\u7528\u4e8e\u52a0\u5bc6\u548c\u7b7e\u540d\u3002<br \/>\n\u7b2c\u4e09\u5217<br \/>\n\u521b\u5efa\u65f6\u95f4<br \/>\n\u7b2c\u56db\u5217<br \/>\n\u8fc7\u671f\u65f6\u95f4<br \/>\n\u7528\u6237\u7684ID\u4e5f\u7d27\u8ddf\u5176\u540e\u3002<\/p>\n<p>GnuPG1 \u4e0e GnuPG2 \u3001GnuPG2.1 \u533a\u522b<br \/>\nhttps:\/\/superuser.com\/questions\/655246\/are-gnupg-1-and-gnupg-2-compatible-with-each-other<\/p>\n<p>GnuPG 1<br \/>\ngpg \u4ecd\u7136\u4fdd\u7559\u7528\u4f5c\u5d4c\u5165\u5f0f\u548c\u670d\u52a1\u5668\u7aef\u4f7f\u7528\uff0c\u8fd9\u4e2a\u66f4\u5c11\u4f9d\u8d56\u4ee5\u53ca\u66f4\u5c0f\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002 \u6765\u81ea man gpg :<\/p>\n<p>This is the standalone version of gpg. For desktop use you should consider using gpg2.<\/p>\n<p>GnuPG 2<br \/>\ngpg2 \u662f gpg \u7684\u91cd\u65b0\u8bbe\u8ba1\u7248\u672c\u2014\u2014 \u4f46\u662f\u66f4\u591a\u7684\u662f\u5728\u5185\u90e8\u7ea7\u522b\u7684\u66f4\u6539\u3002\u8f83\u65b0\u7684\u7248\u672c\u5206\u4e3a\u591a\u4e2a\u6a21\u5757\uff0c\u4f8b\u5982\uff0c\u6709\u53ef\u7528\u4e8e X.509 \u7684\u6a21\u5757<\/p>\n<p>\u6765\u81ea man gpg2<\/p>\n<p>In contrast to the standalone version gpg, which is more suited for server and embedded platforms, this version is commonly installed under the name gpg2 and more targeted to the desktop as it requires several other modules to be installed.<\/p>\n<p>GnuPG 2.1<br \/>\nGnuPG 2.1\u662f\u4e00\u4e2a\u91cd\u8981\u7684\u53d8\u5316\uff0c\u5b83\u5c06\u4ee5\u524d\u5206\u5f00\u7684\u516c\u94a5\u548c\u79c1\u94a5\uff08pubring.gpg vs secring.gpg\uff09\u7ec4\u5408\u5230\u516c\u94a5\u5319\u4e2d\u3002\u8fd9\u662f\u4ee5\u517c\u5bb9\u7684\u65b9\u5f0f\u5b9e\u73b0\u7684\uff0c\u6240\u4ee5\u5f53GnuPG 2.1\u96c6\u6210\u4e86\u79c1\u6709\u5bc6\u94a5\u73af\u65f6\uff0c\u60a8\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528GnuPG 1\uff0c\u4f46\u79c1\u6709\u5bc6\u94a5\u7684\u66f4\u6539\u4e0d\u4f1a\u51fa\u73b0\u5728\u76f8\u5e94\u7684\u5176\u4ed6\u5b9e\u73b0\u4e2d\u3002<\/p>\n<p>[\u2026]\u5141\u8bb8\u4e0eGnuPG 2.1\u5171\u540c\u5b58\u5728\u8f83\u65e7\u7684GnuPG\u7248\u672c\u3002 \u7136\u800c\uff0c\u4f7f\u7528\u65b0gpg\u7684\u79c1\u94a5\u7684\u4efb\u4f55\u66f4\u6539\u5728\u4f7f\u75282.1\u7248\u672c\u7684GnuPG\u4e4b\u524d\u90fd\u4e0d\u4f1a\u51fa\u73b0\uff0c\u53cd\u4e4b\u4ea6\u7136\u3002<\/p>\n<p>emacs \u4e2d\u4f7f\u7528 GnuPG \u6765\u52a0\u89e3\u5bc6\u6ce8\u610f\u4e8b\u9879<br \/>\n\u672c\u4eba\u5728\u4f7f\u7528\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6700\u597d\u5728 emacs orgmode \u4e2d\u4f7f\u7528 GnuPG1 \u6765\u8fdb\u884c\u52a0\u89e3\u5bc6\u3002\u4e0d\u7136\u5bb9\u6613\u6709\u4e00\u4e9b\u5176\u4ed6\u7684\u95ee\u9898\u3002\u6bd4\u5982\u8fd9\u4e2a:<\/p>\n<p>https:\/\/emacs-china.org\/t\/org-crypt\/2585<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f00\u59cb\u4f7f\u7528 \u751f\u6210\u5bc6\u94a5 GnuPG \u4f7f\u7528\u516c\u94a5\u6765\u8fdb\u884c\u52a0\u5bc6\uff0c\u4f7f\u7528\u79c1\u94a5\u6765\u89e3\u5bc6\u3002 gpg \u2013gen-key \u5b83\u7528\u6765\u751f\u6210\u4f60\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-692","post","type-post","status-publish","format-standard","hentry","category-Technical_literature"],"views":2906,"_links":{"self":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/comments?post=692"}],"version-history":[{"count":0,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/692\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/media?parent=692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/categories?post=692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/tags?post=692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}