Skip to main content

Easily encrypted OpenPGP compatible files with python

Project description

Write OpenPGP compatible-encrypted files like it ain’t no thang. Symmetric ciphers only.


Use it by itself:

from encryptedfile import EncryptedFile
f = EncryptedFile("hello.gpg", passphrase=getpass.getpass(),
f.write("super secret message")

Or with something passed through it:

from encryptedfile import EncryptedFile
import PIL
img = ... # obtain image somehow
f = EncryptedFile("pic.png.gpg", passphrase=getpass.getpass(),
                  encryption_algo=EncryptedFile.ALGO_BLOWFISH), "png")

Or use it in a PEP-343 block:

from encryptedfile import EncryptedFile
with EncryptedFile("txt.gpg", passphrase=getpass.getpass()) as f:
     ... use f ...


Let’s say we’re using gpg:

gpg filename

Supply the right passphrase, and tada!


  • Do you support reading?

No, reading would mean supporting the bajillion ways that OpenPGP files have been created throughout history. That would be a pain. I may at some point in time support reading well enough to be able to read whatever written by this module.


“THE BEER-WARE LICENSE” (Revision 42): wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for encryptedfile, version 1.1.1
Filename, size File type Python version Upload date Hashes
Filename, size encryptedfile-1.1.1.tar.gz (5.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page