如何信任一堆您信任的公共pgp密钥,而无需手动进行呢?

时间:2018-12-21 14:49:11

标签: automation gnupg pgp trust

我只需要信任一堆公共密钥即可将其与pass一起使用。 不幸的是,我没有找到一种简单的方法来信任我在本地存储的所有公共密钥。 按时间顺序,我发现它的价格相当昂贵:

> gpg --edit-key XXXXXXXXXXXXXXXX
  gpg (GnuPG) 2.2.10; Copyright (C) 2018 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.

pub  rsa4096/XXXXXXXXXXXXXXXX
     created: 2018-11-16  expires: never       usage: SC  
     trust: unknown       validity: unknown
sub  rsa4096/XXXXXXXXXXXXXXXX
     created: 2018-11-16  expires: never       usage: E   
[ unknown] (1). email@example.com

gpg> trust
pub  rsa4096/XXXXXXXXXXXXXXXX
     created: 2018-11-16  expires: never       usage: SC  
     trust: unknown       validity: unknown
sub  rsa4096/XXXXXXXXXXXXXXXX
     created: 2018-11-16  expires: never       usage: E   
[ unknown] (1). email@example.com

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? y
Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y

pub  rsa4096/XXXXXXXXXXXXXXXX
     created: 2018-11-16  expires: never       usage: SC  
     trust: ultimate      validity: unknown
sub  rsa4096/XXXXXXXXXXXXXXXX
     created: 2018-11-16  expires: never       usage: E   
[ unknown] (1). email@example.com
Please note that the shown key validity is not necessarily correct
unless you restart the program.

gpg> q

如何快速进行?

1 个答案:

答案 0 :(得分:0)

环顾四周,我发现了一个描述该过程的博客: ow-to-ultimately-trust-a-public-key-non-interactively

但是,此处提出的解决方案不适用于当前的gpg版本。 为了使其正常工作,我使用了以下命令:

gpg --list-keys --fingerprint |grep pub -A 1|egrep -Ev "pub|--"|tr -d ' ' \
 | awk 'BEGIN { FS = "\n" } ; { print $1":6:" } ' | gpg --import-ownertrust

基本上,它会创建一个ownertrust文本,然后由gpg即时导入。