You need to use PGP / GnuPG for encryption. Imagine what Python packages will be using. for PGP encryption, that is, on the other hand, PGP is used for decryption.
You can try python-gnupg . The encryption is described in the docs here .