安装gpg

  1. https://sourceforge.net/projects/gpgosx/

生成gpg 密钥

 ✘ albert@192  ~  gpg --full-generate-key
gpg (GnuPG) 2.3.4; Copyright (C) 2021 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
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
   (9) ECC (sign and encrypt) *default*
  (10) ECC (sign only)
  (14) Existing key from card
Your selection?
Please select which elliptic curve you want:
   (1) Curve 25519 *default*
   (4) NIST P-384
   (6) Brainpool P-256
Your selection?
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0) m
invalid value
Key is valid for? (0) 6m
Key expires at 五 10/14 02:11:39 2022 CST
Is this correct? (y/N) n
Key is valid for? (0) 7m
Key expires at 日 11/13 02:12:03 2022 CST
Is this correct? (y/N) y

GnuPG needs to construct a user ID to identify your key.

Real name: Albert Dong
Email address: skydong@dingtalk.co
Comment:
You selected this USER-ID:
    "Albert Dong <skydong@dingtalk.co>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: agent_genkey failed: No pinentry
Key generation failed: No pinentry

执行报错

generator a better chance to gain enough entropy.
gpg: agent_genkey failed: No pinentry
Key generation failed: No pinentry

brew install pinentry

重新生成密钥

 gpg --full-generate-key

image.png

gpg 常用命令

gpg —list-keys 查看密钥列表

gpg —fingerprint [用户ID] 查看公钥指纹

gpg —armor —output public-key.txt —export [用户ID] 输出公钥

gpg —keyserver hkp://keys.gnupg.net —search-keys [用户ID] 搜索别人的密钥

安装pass 密码管理


yum install -y pass ## centos 系统
apt install -y pass ## debian 系统

brew install pass ## mac 系统

image.png