MENU

修改 GPG UID 名称

February 25, 2021 • 开发

之前 GPG UID 名称都是用的 Scvoet,也就是我的用户名。前段时间将各个平台的昵称都改成了我的英文名 Percy,今天将 GPG 的 UID 名称也一起改为我的英文名。

命令所返回的信息有所删减,删去了大部分不必要的确认环节和密钥列表展示。

打开命令行工具,输入 UID 所关联的电子邮箱。

> gpg --edit-key [email protected]
gpg (GnuPG) 2.2.23; Copyright (C) 2020 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.

Secret key is available.

sec  rsa3072/B42805AC703F532A
     created: 2021-02-25  expires: 2023-02-25  usage: SC
     trust: ultimate      validity: ultimate
ssb  rsa3072/8EA8D7910D16C163
     created: 2021-02-25  expires: 2023-02-25  usage: E
[ultimate] (1). Scvoet <[email protected]>

先添加一个新的 UID

gpg> adduid

中间会出现要求你依次填写 UID 的相关信息,只需输入新的名称,其他信息与旧 UID 保持一致即可。

Real name: Percy
Email address: [email protected]
Comment:
You selected this USER-ID:
    "Percy <[email protected]>"

完成后确认信息,确认后会要求你输入证书对应的密码句(passphrase)。

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? 

新的 UID 出现了。

sec  rsa3072/B42805AC703F532A
     created: 2021-02-25  expires: 2023-02-25  usage: SC
     trust: ultimate      validity: ultimate
ssb  rsa3072/8EA8D7910D16C163
     created: 2021-02-25  expires: 2023-02-25  usage: E
[ultimate] (1). Scvoet <[email protected]>
[ unknown] (2)* Percy <[email protected]>

先提升新 UID 的信任等级,因为生成后就已经选中了,所以我们不需要先选择,直接进行操作即可。

gpg> trust
Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

  1 = I don't know or won't say
  2 = I do NOT trust
  3 = I trust marginally
  4 = I trust fully
  5 = I trust ultimately
  m = back to the main menu

Your decision?

一般情况下,选择 5 完全信任即可,稍后还会有确认环节。

现在选中旧的 UID。

gpg> uid 1

选中后数字旁边将会出现 * 号注明。

sec  rsa3072/B42805AC703F532A
     created: 2021-02-25  expires: 2023-02-25  usage: SC
     trust: ultimate      validity: ultimate
ssb  rsa3072/8EA8D7910D16C163
     created: 2021-02-25  expires: 2023-02-25  usage: E
[ultimate] (1) Scvoet <[email protected]>
[ unknown] (2)* Percy <[email protected]>

删除它,依旧有确认环节。

gpg> deluid

最后保存改名就完成了。

gpg> save
Last Modified: March 19, 2021