Skip to main content

File-oriented privacy & integrity management tools

Project description

pyFileSec provides robust yet easy-to-use tools for working with files that may contain sensitive information. The aim is to achieve an “industry standard” level of strong privacy, capable of protecting confidential information from inspection or accidental disclosure. Integrity assurance may be useful in archival and provenance applications.


The motivation for developing pyFileSec is to better secure research data obtained from human subjects, e.g., in combination with PsychoPy ( or the Open Science Framework ( The hope is that pyFileSec will be more widely useful. For example, command-line options make it accessible from non-python or non-open-source programs.

Several truly excellent Python packages are available for encryption. However, file security requires more than just good encryption. The main and potentially unique contribution of pyFileSec is that it aspires to provide cross-platform, secure file-management with a low barrier to entry and a stable API going forward. These considerations motivate many of the design choices.

The main functions provided include encryption (encrypt, decrypt, rotate) and verification (sign, verify). It is also easy to obscure file length (pad, unpad), securely remove files from disk (destroy) and inspect meta-data. Large files (tested up to 8G) and command-line usage are also supported.

By default, file permissions are set to conservative values (only Mac & linux at this point). Unencrypted files are deleted securely after a successful encryption. Multiple hardlinks, version control, and Dropbox folders are detected and reported.

Public-key (asymmetric) encryption is used for security and flexibility, currently relying on calls to OpenSSL for all cryptography. The aim is to provide a robust and easily extensible framework for adding other encryption backends, without requiring changes to the API.

Bug reports and code contributions are welcome; the project is on github and you can contact me there ( For contacting me privately, e.g., about security issues, please look for my gmail address at the top of the main code. Help with Windows would be particularly welcome (see the issues list).


Jeremy R. Gray - package author (GPG key D934B0D7)

Thanks to

Michael Stone - awesome code review

Sol Simpson - Windows compatibility


  • 0.3 class SecFile; Python 3 (2to3 mostly passes now)
  • 0.4 An alternative encryption backend (possibly pycrypto and gpg support)
  • 0.5 Windows file-permissions

See also

  • pyCrypto, M2Crypto, pyOpenSSL - excellent crypto packages, no or few sys-admin features
  • pycogworks.crypto - similar audience as pyfilesec, no file encyrption
  • Ephemeral - provides encrypted temporary files

Project details

Release history Release notifications

History Node


History Node


History Node


History Node


This version
History Node

0.2.10 alpha

History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
PyFileSec-0.2.10 alpha.tar.gz (64.0 kB) Copy SHA256 hash SHA256 Source None Sep 2, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page