How to list recipients of a public key - GPG

Posted on 2011-10-14
Last Modified: 2013-11-15
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.
Question by:jbaird123
    LVL 33

    Expert Comment

    "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

    Author Comment

    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.  

    LVL 33

    Expert Comment

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


    Author Comment


    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.

    LVL 60

    Accepted Solution

    Try out --edit -key and adduid, can have multiple email and have one set as primary

    Author Closing Comment

    This seems to work.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
    Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
    The viewer will learn how to create multiple layers to apply various filters and how to delete areas from each layer’s filter.
    The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now