If you need to locate someone's PGP key on a PGP server using
gpg --search-keys --keyserver <servername>
<name>
, where "servername" is the name of the PGP server where
the key is stored and "name" is the person's name. For instance,
suppose the person's last name is Pacheo and the applicable key server
is server1.somewhere.com, then you would use
gpg --search-keys --keyserver server1.somewhere.com pacheo
.
If there were multiple keys on the server that matched, you would see
a numbered list of all matching keys and would be prompted to enter
the number for the one you want. Once you select the one you want,
you should see a message indicating the public key for the person has
been imported to your keyring. If you issue the command
gpg --list-keys
, you should see the new key listed.
If the email address associated with the new key was pacheo@abcxyz.com and
you wanted to send the file confinfo.xls as an encrypted attachment to
an email to the person, you could use gpg --encrypt -r pacheo@abcxyz.com
confinfo.xls
. Gnupg would then
create a new encrypted version of the
file called confinfo.xls.gpg, which you could attach to your email. The
recipient, who you specify with the "-r" option, would then need a program on
his end, such as gnupg, PGP, etc. that could decrypt the file, producing a
duplicate of the original confinfo.xls file.
In the above example, you would be using the person's public key to encrypt the file. Only someone who has the associated private key, which should only be that person or someone he very much trusts, will be able to decrypt the file. You don't need his private key to encrypt the file, only the public key, which he can make available to anyone via the key server.