How to list recipients of a public key - GPG

Can someone tell me how to display the valid recipients of a public key using GPG?

I am currently running this command :

gpg --list-keys

The problem is that it seems to work on one machine, but not on the machine I need it to work on.  I want to see the email address, but it is not being displayed.
Who is Participating?
btanExec ConsultantCommented:
Try out --edit -key and adduid, can have multiple email and have one set as primary
"gpg --list-keys" would list out the keys known in that host's database.       Just because 1 machine can list the keys correctly, doesn't mean that the 2nd machine has come across the same public keys yet.  

You would need to search the gpg key directory to add them or add them any other way before they would be listed using that command.

With the GnuPG system comes a file that acts as some kind of database. In this file all data regarding keys with the information that comes with the keys is stored (everything until the Ownertrust values: for more information on that read Key signing). With

    gpg --list-keys

all present keys will be displayed
jbaird123Author Commented:
MikeKane :

The keys i need are being listed, but the recipient is not being displayed.  I don't know how to figure out the recipient associated with the key.  

Managing Security Policy in a Changing Environment

The enterprise network environment is evolving rapidly as companies extend their physical data centers to embrace cloud computing and software-defined networking. This new reality means that the challenge of managing the security policy is much more dynamic and complex.

How about this:
gpg --list-keys --with-fingerprint --with-colons --fixed-list-mode

jbaird123Author Commented:

It looks like I may not have asked the correct question.  After further investigation, it looks like the recipient is being displayed, but not the email address.  Example:

pub   1024D/E0104178 2011-08-09
uid                  John Smith (Test Key - DSA / Elgamal) <>
sub   1024g/DDB8A046 2011-08-09

In the example above, the --list-keys command outputs both the recipient name (John Smith) and the email address "".

The problem is that when I run this same command on the "other" machine, I will get the name "John Smith", but no email address.  I am really interested in getting the email but cannot figure out how to di it.

I ran your code above and it does not list the email address either.  It does show the name though.

Please advise.

jbaird123Author Commented:
This seems to work.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.