Пример #1
0
 def get_content(self, fp):
   '''Return a file object representing the latest content for this bundle.'''
   enc = tempfile(self.conf)
   dec = tempfile(self.conf)
   self.dir.read_to_file(CONTENT_FILE, enc)
   enc.seek(0)
   self.crypto.decrypt(enc, dec)
   dec.seek(0)
   del enc
   return dec
Пример #2
0
 def add_content(self, input, md5=None):
   '''Write a new content entry, encrypted using the current AES key.'''
   tf = tempfile(self.conf)
   self.crypto.encrypt(input, tf)
   tf.seek(0)
   self.dir.write(CONTENT_FILE, tf.read(), md5)
   del tf