Как пользоваться GPG

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

$ gpg --list-keys
gpg: directory `/home/vasily/.gnupg' created
gpg: new configuration file `/home/vasily/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/vasily/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/vasily/.gnupg/pubring.gpg' created
gpg: /home/vasily/.gnupg/trustdb.gpg: trustdb created

$ ls -la ~/.gnupg/
total 56
drwx------  2 vasily vasily  4096 Aug 27 18:57 .
drwx------ 25 vasily vasily 12288 Aug 27 18:57 ..
-rw-------  1 vasily vasily  9398 Aug 27 18:57 gpg.conf
-rw-------  1 vasily vasily     0 Aug 27 18:57 pubring.gpg
-rw-------  1 vasily vasily    40 Aug 27 18:57 trustdb.gpg


Просмотр списка ключей при наличии одного сгенерированного через gpg --gen-key:

$ gpg --list-keys       
/home/vasily/.gnupg/pubring.gpg
------------------------------
pub   2048R/5EFB92E2 2017-08-27
uid                  Василий Пупкин (специалист) <pupkin@mail.ru>
sub   2048R/5676242D 2017-08-27

$ gpg --list-secret-keys
/home/vasily/.gnupg/secring.gpg
------------------------------
sec   2048R/5EFB92E2 2017-08-27
uid                  Василий Пупкин (специалист) <pupkin@mail.ru>
ssb   2048R/5676242D 2017-08-27

$ gpg --list-keys --with-colons
tru::1:1503837714:0:3:1:5
pub:u:2048:1:448976AF5EFB92E2:2017-08-27:::u:Василий Пупкин (специалист) <pupkin@mail.ru>::scESC:
sub:u:2048:1:875973685676242D:2017-08-27::::::e:



https://wiki.debian.org/Subkeys

Creating a new GPG key with subkeys


Удаление публичного ключа при наличии ассоциированного с ним секретного выдает ошибку:

$ gpg --delete-key "Василий Пупкин"
gpg (GnuPG) 1.4.20; Copyright (C) 2015 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: there is a secret key for public key "Василий Пупкин"!
gpg: use option "--delete-secret-keys" to delete it first.

Поэтому сначала нужно удалить приватный ключ:

$ gpg --delete-secret-key "Василий Пупкин"
gpg (GnuPG) 1.4.20; Copyright (C) 2015 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.


sec  2048R/5EFB92E2 2017-08-27 Василий Пупкин (специалист) <pupkin@mail.ru>

Delete this key from the keyring? (y/N) y
This is a secret key! - really delete? (y/N) y
$ gpg --list-secret-keys
$ gpg --list-keys
/home/vasily/.gnupg/pubring.gpg
------------------------------
pub   2048R/5EFB92E2 2017-08-27
uid                  Василий Пупкин (специалист) <pupkin@mail.ru>
sub   2048R/5676242D 2017-08-27

И только потом публичный:

$ gpg --delete-key "Василий Пупкин"
gpg (GnuPG) 1.4.20; Copyright (C) 2015 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  2048R/5EFB92E2 2017-08-27 Василий Пупкин (специалист) <pupkin@mail.ru>

Delete this key from the keyring? (y/N) y
$ gpg --list-keys
gpg: checking the trustdb
gpg: no ultimately trusted keys found
$ gpg --list-secret-keys


--