-
-
Save gasull/cc6c268ff4bcfb36fdf990bb20b27c02 to your computer and use it in GitHub Desktop.
List GPG Ownertrust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import sys | |
| import os | |
| import gnupg | |
| TRUST_LEVEL_MAP = { | |
| 'q': '???', | |
| 'n': 'Not', | |
| 'm': 'Marginal', | |
| 'f': 'Full', | |
| 'u': 'Ultimate' | |
| } | |
| def main(): | |
| gpg = gnupg.GPG() | |
| gpg.encoding = 'utf-8' | |
| keys = gpg.list_keys() | |
| trust_keys = filter(lambda k: k['ownertrust'] != '-', keys) | |
| for key in trust_keys: | |
| trust_level = TRUST_LEVEL_MAP[key['ownertrust']] | |
| print('{} {:<59} {}'.format(key['fingerprint'], key['uids'][0], trust_level)) | |
| return os.EX_OK | |
| if __name__ == '__main__': | |
| sys.exit(main()) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forked from @F30's original script. The long format of the key (fingerprint) is better since that's what is needed for later running
gpg --edit-key.