Skip to content

Instantly share code, notes, and snippets.

@perfecto25
Created January 6, 2020 22:04
Show Gist options
  • Save perfecto25/280710687aa5e11e08855e093f9bbdf1 to your computer and use it in GitHub Desktop.
Save perfecto25/280710687aa5e11e08855e093f9bbdf1 to your computer and use it in GitHub Desktop.
gpg py
#!/usr/bin/env python
import gnupg
from pprint import pprint
gpg_home = '/home/user/.gnupg'
def show_keys():
gpg = gnupg.GPG(gnupghome=gpg_home)
public_keys = gpg.list_keys()
private_keys = gpg.list_keys(True)
all_keys = {}
print(type(public_keys))
all_keys['public'] = public_keys
all_keys['private'] = private_keys
return all_keys
if __name__ == "__main__":
pprint(show_keys())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment