gpt4 book ai didi

gnupg - 如何通过 GPG(GnuPG) 中的子 key (多个子 key (e))加密

转载 作者:行者123 更新时间:2023-12-04 00:06:12 26 4
gpt4 key购买 nike

如何通过 GPG(GnuPG) 中的子 key (多个子 key (e))加密

pub   rsa4096/22E49AB870AD169A 2017-03-09 [SC]
uid [ultimate] Jack Wonda <wangjievibeke@foxmail.com>
uid [ultimate] 王杰 <jack20130107@qq.com>
sub rsa4096/D39A707D61F13A26 2017-03-09 [E] [expires: 2020-04-25]
sub rsa4096/11FAB3E82F75B202 2017-04-24 [S] [expires: 2019-04-24]
sub rsa4096/B305BA41FD1F7793 2017-04-26 [E] [expires: 2019-04-26]

我有两个用于加密的子 key ,但现在我只能使用最后一个子 key (B305BA41FD1F7793)。

例如:
gpg2 -r D39A707D61F13A26 -e doc
File 'doc.gpg' exists. Overwrite? (y/N) y
gpg2 -d doc.gpg
gpg: encrypted with 4096-bit RSA key, ID B305BA41FD1F7793, created 2017-04-26
"Jack Wonda <wangjievibeke@foxmail.com>"
123456

即使我指定了第一个子项,它仍然会转到最后一个。

最佳答案

您可以通过在其 id 后附加一个感叹号来强制 gpg 使用特定的键。在你的情况下:

gpg2 -r 0xD39A707D61F13A26! -e doc

你甚至可以要求 gpg 用 加密两者 key (因此您可以使用任一关联的公钥进行解密):
gpg2 -r 0xD39A707D61F13A26! -r 0xB305BA41FD1F7793! -e doc

根据我的 Arch 系统上安装的联机帮助页(奇怪的是,我在其他地方找不到具有相同信息的相同版本):

HOW TO SPECIFY A USER ID

There are different ways to specify a user ID to GnuPG. Some of them are only valid for gpg others are only good for gpgsm. Here is the entire list of ways to specify a key:

By key Id.
This format is deduced from the length of the string and its
content or 0x prefix. The key Id of an X.509 certificate are the
low 64 bits of its SHA-1 fingerprint. The use of key Ids is
just a shortcut, for all automated processing the fingerprint
should be used.

When using gpg an exclamation mark (!) may be appended to force
using the specified primary or secondary key and not to try and
calculate which primary or secondary key to use.

The last four lines of the example give the key ID in their long
form as internally used by the OpenPGP protocol. You can see the
long key ID using the option --with-colons.

关于gnupg - 如何通过 GPG(GnuPG) 中的子 key (多个子 key (e))加密,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43732404/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com