encrypting files + filestreams?
jstroud at mbi.ucla.edu
Wed Aug 15 23:36:01 CEST 2007
> Also I wonder if this can be solved with filestreams (Are there
> streams in python? The only python file streams I found in the evil
> search engine was stuff in other forums.)
Check the source to: http://passerby.sf.net
In it you will find the jenncrypt module that makes a file-like wrapper
around streams for encrypting and handles padding, etc. It is designed
for a block cipher. This is not a trivial task, actually, but all the
code is in there. It is not intensely well documented. It is somewhat
well organized but this was my first full size attempt at a python
application. Please read the notes to the "SecureRandom" module inside
if you decide to use that module as the "name is misleading" under
certain circumstances. It is used for the padding, although the
randomness of the padding in a block cipher is in principle not a
practical security issue in most cases. Other than the pad generation,
the encryption algorithm is drop-in and I use the pycrypto
implementation of AES.
Read at least Schneier if you want to get started with such things as
there are many caveats to using cryptographic systems.
UCLA-DOE Institute for Genomics and Proteomics
Los Angeles, CA 90095
More information about the Python-list