@@ -641,6 +641,67 @@ is a list of the key fingerprints associated with the listed keys.
641641 straight to the key info, whether the fingerprint you have is for a key or a
642642 subkey.
643643
644+ .. versionadded :: 0.5.5
645+ The returned value from :meth: `~gnupg.GPG.list_keys ` now has a new
646+ attribute, ``uid_map ``, which is a dictionary mapping uids to dicts with
647+ detailed information about the corresponding uid. The keys of the information
648+ provided are listed in the table above. Refer to the `GnuPG documentation
649+ <https://github.com/gpg/gnupg/blob/master/doc/DETAILS> `_ for more information.
650+
651+ You could use this information as in the following example:
652+
653+ .. code-block :: pycon
654+
655+ >>> from pprint import pprint
656+ >>> keys = gpg.list_keys()
657+ >>> pprint(keys.uids)
658+ ['Andrew Able (A test user) <[email protected] >', 659+ 660+ 661+ 'Barbara Brown (A test user) <[email protected] >', 662+ 'Charlie Clark (A test user) <[email protected] >', 663+ 'Donna Davis (A test user) <[email protected] >'] 664+ >>> pprint(keys.uid_map('Barbara Brown (A test user) <[email protected] >') 665+ {'algo': '',
666+ 'date': '1739485458',
667+ 'dummy': '8B989767967370B894C53279A3BDF655F00CD4DE',
668+ 'expires': '',
669+ 'keyid': '',
670+ 'length': '',
671+ 'ownertrust': '',
672+ 'sig': '',
673+ 'trust': 'u',
674+ 'type': 'uid',
675+ 'uid': 'Barbara Brown (A test user) <[email protected] >'} 676+ >>> pprint(keys.uid_map['Barb Bruin <[email protected] >']) 677+ {'algo': '',
678+ 'date': '1739485886',
679+ 'dummy': '951261047308BCA0B45FD738AD8630B336B88ECF',
680+ 'expires': '',
681+ 'keyid': '',
682+ 'length': '',
683+ 'ownertrust': '',
684+ 'sig': '',
685+ 'trust': 'u',
686+ 'type': 'uid',
687+ 'uid': 'Barb Bruin <[email protected] >'} 688+ >>> pprint(keys.uid_map['Babs Broon <[email protected] >']) 689+ {'algo': '',
690+ 'date': '',
691+ 'dummy': '2BDB74660AC54DF33DE523429386E2D460904E74',
692+ 'expires': '',
693+ 'keyid': '',
694+ 'length': '',
695+ 'ownertrust': '',
696+ 'sig': '',
697+ 'trust': 'r',
698+ 'type': 'uid',
699+ 'uid': 'Babs Broon <[email protected] >'} 700+ >>>
701+
702+ The first two of these dictionaries show normal uids (trust is 'u', for ultimate), whereas the third
703+ shows a revoked uid (trust is 'r', for revoked).
704+
644705.. versionadded :: 0.3.8
645706 You can also list a subset of keys by specifying a ``keys= `` keyword
646707 argument to :meth: `~gnupg.GPG.list_keys ` whose value is either a single
0 commit comments