Package duplicity :: Module gpg
[hide private]
[frames] | no frames]

Module gpg

source code

duplicity's gpg interface, builds upon Frank Tobin's GnuPGInterface

Classes [hide private]
  GPGError
Indicate some GPG Error
  GPGProfile
Just hold some GPG settings, avoid passing tons of arguments
  GPGFile
File-like object that encrypts decrypts another file on the fly
Functions [hide private]
 
GPGWriteFile(block_iter, filename, profile, size=209715200, max_footer_size=16384)
Write GPG compressed file of given size
source code
 
GzipWriteFile(block_iter, filename, size=209715200, max_footer_size=16384)
Write gzipped compressed file of given size
source code
 
get_hash(hash, path, hex=1)
Return hash of path
source code
Variables [hide private]
  blocksize = 262144
  __package__ = 'duplicity'
Function Details [hide private]

GPGWriteFile(block_iter, filename, profile, size=209715200, max_footer_size=16384)

source code 

Write GPG compressed file of given size

This function writes a gpg compressed file by reading from the input iter and writing to filename. When it has read an amount close to the size limit, it "tops off" the incoming data with incompressible data, to try to hit the limit exactly.

block_iter should have methods .next(size), which returns the next block of data, which should be at most size bytes long. Also .get_footer() returns a string to write at the end of the input file. The footer should have max length max_footer_size.

Because gpg uses compression, we don't assume that putting bytes_in bytes into gpg will result in bytes_out = bytes_in out. However, do assume that bytes_out <= bytes_in approximately.

Returns true if succeeded in writing until end of block_iter.

GzipWriteFile(block_iter, filename, size=209715200, max_footer_size=16384)

source code 

Write gzipped compressed file of given size

This is like the earlier GPGWriteFile except it writes a gzipped file instead of a gpg'd file. This function is somewhat out of place, because it doesn't deal with GPG at all, but it is very similar to GPGWriteFile so they might as well be defined together.

The input requirements on block_iter and the output is the same as GPGWriteFile (returns true if wrote until end of block_iter).

get_hash(hash, path, hex=1)

source code 

Return hash of path

hash should be "MD5" or "SHA1". The output will be in hexadecimal form if hex is true, and in text (base64) otherwise.