> Where I am confused is when using gpg.encrypt_file(stream). What is
> this returning? Is expecting to encrypt a whole file or just up to the
> end of the stream, so the next time I call encrypt_file(stream) it
> will continue where it left off.
If you pass encrypt_file a file-like object, then it should work as
you expect, but with a single encrypt_file call rather than multiple
calls. The encrypted stream should be streamed out to gpg's stdout,
which is picked up by the Python code and buffered in memory: if you
want to do this differently (e.g. only keep some parts of the
encrypted file in memory at a time) you will need to handle this
yourself by subclassing GPG. Take a look at the source code to see how
stdout data from gpg is being handled.
Regards,
Vinay Sajip