python-gnupg
python-gnupg is a Python library to interact with gpg taking care of the internal details and allows its users to generate and manage keys, encrypt and decrypt data, and sign and verify messages.
Installation⚑
pip install python-gnupg
Usage⚑
You interface to the GnuPG functionality through an instance of the GPG class:
gpg = gnupg.GPG(gnupghome="/path/to/home/directory")
- Decrypt a file:
gpg.decrypt_file("path/to/file")
Note: You can't pass Path arguments to decrypt_file.
>>> public_keys = gpg.list_keys()
>>> private_keys = gpg.list_keys(True)