I know that I can create a GPG keypair from the CentOS 7 terminal by typing
gpg --gen-key and following the resulting steps, but how can I make sure that the resulting public key is self-signed? And how can I send the resulting key via email to a remote computer?
I know that I can send an email with an attachment using mailx from the command line as follows:
echo "this is the body of the email" | mailx -s"Subject" -a public.key Someone@Domain.com
But the mailx code snipped assumes that the key is available in a file. In reality, the key is locked up in a keyring and needs other syntax in order for it to be accessed.
I am following @HaukeLaging's advice. I have created a new key, but when I type
gpg --list-sigs in the command line, I get the following results:
/home/username/.gnupg/pubring.gpg ----------------------------------------- pub 4096R/CODE1 2015-02-04 uid User Name <firstname.lastname@example.org> sig 3 CODE1 2015-02-04 User Name <email@example.com> sub 4096R/CODE2 2015-02-04 sig CODE1 2015-02-04 User Name <firstname.lastname@example.org>
Which of these key codes is the public key? And Which is the private key? I do not want to accidentally send the private key to anyone.
As per @HaukeLaging's response to EDIT#1, I tried:
`sudo gpg --armor --export CODE1 >/home/username/my_public_cert.asc`
but the result is an empty file when I then
cd /home/username/ and
gpg --list-packets /home/username/my_public_cert.asc
gpg: processing message failed: Unknown system error
gpg --armor --export CODE1 >/home/username/my_public_cert.asc producing an empty file?