Список все ключи с SHA-1 в наборе ключей gpg

Используя встроенную оболочку read-, вы можете считывать данные из stdinи сохранять прочитанные данные в переменных оболочки:

$ echo foo bar baz | read a b c
$ echo $a
foo
$ echo $b
bar
$ echo $c
baz

Как вы можете видеть, readразделения вводятся в поля. Разделение ввода определяется переменной $IFSразделителем полей ввода). Установив для $IFSпустое значение, разделение ввода отключается, и вы можете сохранить всю строку в одну переменную :

.
$ echo foo bar baz | IFS= read foo
$ echo $foo
foo bar baz
0
12.01.2020, 13:03
1 ответ

Чтобы получить подробную информацию об алгоритмах хеширования, назначенных для использования с определенным ключом, отредактируйте ключ, а затем отобразите список предпочтений ключа.:

gpg --list-keys

Получите отпечаток ключа, который вы хотите запросить, а затем отредактируйте его, чтобы запросить настройки ключа:

gpg --edit-key <key fingerprint>
gpg> showpref
[ unknown] (1). Bob Smith (GPG Key) <bob@smith.domain>
     Cipher: AES, CAST5, 3DES
     Digest: SHA1, RIPEMD160
     Compression: ZLIB, ZIP, Uncompressed
     Features: MDC, Keyserver no-modify

Вы можете управлять хешем, используемым для генерации ключа, в командной строке, например, с помощью «--cert -дайджест -алгоритм SHA512» и «--s2k -дайджест -алгоритм ША512". Смотрите справочную страницу для более подробной информации.

Вы также можете изменить настройки по умолчанию. «gpg --version» покажет ваши текущие настройки. Отредактируйте gpg.conf, чтобы явно удалить SHA1 для будущего создания ключа по умолчанию для сбросов setpref :

.
personal-cipher-preferences AES256 TWOFISH AES192 AES
personal-digest-preferences SHA512 SHA384 SHA256
personal-compress-preferences ZLIB BZIP2 ZIP

Из справочной страницы:

showpref

More verbose preferences listing for the selected user ID. This shows the preferences in effect by including the implied preferences of 3DES (cipher), SHA-1 (digest), and Uncompressed (compression) if they are not already included in the preference list. In addition, the preferred keyserver and signature notations (if any) are shown.

setpref string

Set the list of user ID preferences to string for all (or just the selected) user IDs. Calling setpref with no arguments sets the preference list to the default (either built-in or set via --default-preference-list), and calling setpref with "none" as the argument sets an > empty preference list. Use gpg2 --version to get a list of available algorithms. Note that while you can change the preferences on an attribute user ID (aka "photo ID"), GnuPG does not select keys via attribute user IDs so these preferences will not be used by GnuPG. When setting preferences, you should list the algorithms in the order which you'd like to see them used by someone else when encrypting a message to your key. If you don't include 3DES, it will be automatically added at the end. Note that there are many factors that go into choosing an algorithm (for example, your key may not be the only recipient), and so the remote OpenPGP application being used to send to you may or may not follow your exact chosen order for a given message. It will, however, only choose an algorithm that is present on the preference list of every recipient key. See also the INTEROPERABILITY WITH OTHER OPENPGP PROGRAMS section below.

Для автоматизации потребуется извлечь каждый ключ, а затем запросить prefs.

2
28.01.2020, 02:38

Теги

Похожие вопросы