V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Apol1oBelvedere
V2EX  ›  问与答

[求助] 如何在 GPG 公钥中设置多组个人信息(姓名+电子邮件)?

  •  
  •   Apol1oBelvedere · 2020-03-20 18:30:57 +08:00 · 1499 次点击
    这是一个创建于 1512 天前的主题,其中的信息可能已经有所发展或是发生改变。

    通过命令查询一个人的 GPG 公钥:

    gpg --keyserver hkp://pool.sks-keyservers.net:80 --search-keys 0x94CBAFDD30345109561835AA0B7F8B60E3EDFAE3
    

    得到结果:

    gpg: data source: http://209.244.105.201:80
    (1)	Kristian Fiskerstrand <[email protected]>
    	Kristian Fiskerstrand <[email protected]>
    	Kristian Fiskerstrand <[email protected]>
    	Kristian Fiskerstrand <[email protected]>
    	  4096 bit RSA key 0B7F8B60E3EDFAE3, 创建于:2007-12-15, 有效至:2019-12-31 (已过期)
    

    请问如何在 GPG 公钥中设置多组个人信息(姓名+电子邮件)?设置自己公钥的时候不是只让设置一次姓名和电子邮件吗?

    gpg (GnuPG) 2.2.4
    libgcrypt 1.8.1
    Copyright (C) 2017 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Home: /home/user/.gnupg
    支持的算法:
    公钥:RSA, ELG, DSA, ECDH, ECDSA, EDDSA
    密文:IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
    散列:SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
    压缩: 不压缩, ZIP, ZLIB, BZIP2
    
    
    8 条回复    2020-03-23 15:23:15 +08:00
    Dreax
        1
    Dreax  
       2020-03-20 18:33:59 +08:00
    adduid?
    input2output
        2
    input2output  
       2020-03-20 19:27:28 +08:00
    gpg --edit-key
    然后 adduid
    Apol1oBelvedere
        3
    Apol1oBelvedere  
    OP
       2020-03-20 19:40:21 +08:00
    @Dreax
    @input2output
    谢谢,请问已经设置好名字、电子邮件、注释的 uid,有没有办法进行修改?没有找到办法,只找到 delkey 直接删除的命令。

    gpg (GnuPG) 2.2.4; Copyright (C) 2017 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.
    用法:gpg [选项] --edit-key user-id [commands]

    ---
    gpg> help
    quit 退出此菜单
    save 保存并退出
    help 显示此帮助
    fpr 显示密钥指纹
    grip 显示 keygrip
    list 列出密钥和用户标识
    uid 选择用户标识 N
    key 选择子密钥 N
    check 检查签名
    sign 为所选用户标识添加签名 [* 参见下面的相关命令]
    lsign 为所选用户标识添加本地签名
    tsign 为所选用户标识添加信任签名
    nrsign 为所选用户标识添加不可吊销签名
    adduid 增加一个用户标识
    addphoto 增加一个照片标识
    deluid 删除选定的用户标识
    addkey 增加一个子密钥
    addcardkey 增加一个密钥到智能卡
    keytocard 移动一个密钥到智能卡
    bkuptocard 移动一个备份密钥到智能卡上
    delkey 删除选定的子密钥
    addrevoker 增加一个吊销用密钥
    delsig 从所选用户标识上删除签名
    expire 变更密钥或所选子密钥的使用期限
    primary 标记所选的用户标识为主要
    pref 列出偏好设置(专家模式)
    showpref 列出偏好设置(详细模式)
    setpref 为所选用户标识设定偏好设置列表
    keyserver 为所选用户标识设定首选公钥服务器 URL
    notation 为所选用户标识的设定注记
    passwd 变更密码
    trust 变更信任度
    revsig 吊销所选用户标识上的签名
    revuid 吊销选定的用户标识
    revkey 吊销密钥或选定的子密钥
    enable 启用密钥
    disable 禁用密钥
    showphoto 显示选定的照片标识
    clean 压缩不可用的用户标识并从密钥上移除不可用的签名
    minimize 压缩不可用的用户标识并从密钥上移除所有签名

    * ‘sign’命令可以通过‘l’前缀( lsign )进行本地签名,‘t’前缀( tsign )进行
    信任签名,‘nr’前缀( nrsign )进行不可吊销签名,
    或者上述三种前缀的任意组合( ltsign、tnrsign 等)。
    input2output
        4
    input2output  
       2020-03-20 19:47:15 +08:00
    @Apol1oBelvedere #3

    deluid
    然后再 adduid

    好像不能直接修改
    Apol1oBelvedere
        5
    Apol1oBelvedere  
    OP
       2020-03-20 19:48:08 +08:00
    @input2output 谢谢
    Tyanboot
        6
    Tyanboot  
       2020-03-21 03:20:25 +08:00
    UID 不能修改, 只能删了重建.

    并且需要注意的是, 如果你已经把公钥上传到了公开的密钥服务上的话, 你连删除 UID 都做不到, 只能吊销 UID. 就算你本地删了 UID, 再重新上传修改后的公钥, 也是不认的.

    这样设计是为了防止出现例如, 你有一个叫 AAA 的 UID, 有很多人给这个 UID 进行了签名操作, 然后你又把 AAA"改"成了 BBB, 这样原本给 AAA 的签名就变成了给 BBB 的, 明显是不安全的. 所以只能吊销不能修改.
    Apol1oBelvedere
        7
    Apol1oBelvedere  
    OP
       2020-03-21 10:12:14 +08:00
    @Tyanboot 谢谢,正是由于不可篡改性,我没有上传公钥。
    julyclyde
        8
    julyclyde  
       2020-03-23 15:23:15 +08:00
    @Apol1oBelvedere 自己不上传其实没啥用
    因为别人可以上传
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3299 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 338ms · UTC 11:47 · PVG 19:47 · LAX 04:47 · JFK 07:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.