C:\WINDOWS\system32>gpg --gen-keygpg (GnuPG) 2.0.30; Copyright (C) 2015 Free Software Foundation, Inc.This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.Please select what kind of key you want: (1) RSA and RSA (default) (2) DSA and Elgamal (3) DSA (sign only) (4) RSA (sign only)Your selection? 1 #选择密钥类型(这里我们选择加密算法是RSA、数字签名算法也是RSA)RSA keys may be between 1024 and 4096 bits long.What keysize do you want? (2048) 2048 #设置密钥的比特数Requested keysize is 2048 bitsPlease specify how long the key should be valid. 0 = key does not expire = key expires in n days w = key expires in n weeks m = key expires in n months y = key expires in n yearsKey is valid for? (0) 0 #设置密钥有效期(永不过期)Key does not expire at allIs this correct? (y/N) y #确认有效性GnuPG needs to construct a user ID to identify your key.Real name: Ron #输入姓名Name must be at least 5 characters long #姓名至少为5个字符Real name: ron.zheng #输入姓名Email address: ron.zheng@tfschange.com #输入邮箱地址Comment: tfs #输入备注You selected this USER-ID: "ron.zheng (tfs) "Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o #选择OKYou need a Passphrase to protect your secret key. #弹出口令输入界面We need to generate a lot of random bytes. It is a good idea to performsome other action (type on the keyboard, move the mouse, utilize thedisks) during the prime generation; this gives the random numbergenerator a better chance to gain enough entropy.We need to generate a lot of random bytes. It is a good idea to performsome other action (type on the keyboard, move the mouse, utilize thedisks) during the prime generation; this gives the random numbergenerator a better chance to gain enough entropy.gpg: key 0452FE75 marked as ultimately trustedpublic and secret key created and signed.gpg: checking the trustdbgpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust modelgpg: depth: 0 valid: 2 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 2upub 2048R/0452FE75 2019-03-28 Key fingerprint = 65B4 846F 7E63 A32B 34E3 A9FB C99D B8B9 0452 FE75uid [ultimate] ron.zheng (tfs) sub 2048R/488F27D2 2019-03-28//输入命令查看生成的秘钥gpg --list-secret-keys --keyid-format LONGsec rsa2048/XXXXXXXXX 2020-09-22 [SC] XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXuid [ultimate] fashionbrot (描述) ssb rsa2048/xoxoxoxoxo 2020-09-22 [E]//然后公钥上传服务器 (XXXXXXXXX)是sec rsa2048/后面的gpg --keyserver hkp://pool.sks-keyservers.net:11371 --send-keys XXXXXXXXXgpg --keyserver keyserver.ubuntu.com --send-keys XXXXXXXXXgpg --keyserver pgp.mit.edu --send-keys XXXXXXXXXgpg --keyserver keys.gnupg.net --send-keys XXXXXXXXX