def makeFile(self, contents, mode): if len(contents) % self.cipher.block_size != 0: raise ValueError("content must be multiple of blocksize.") s = StringIO(self.cipher.encrypt(contents)) f = Decrypt(s, self.cipher, mode=mode) f.getvalue = def_getvalue_maybe_buffered(f, s, self.cipher.decrypt) return f
def makeFile(self,contents,mode): if len(contents) % self.cipher.block_size != 0: raise ValueError("content must be multiple of blocksize.") s = StringIO(self.cipher.encrypt(contents)) f = Decrypt(s,self.cipher,mode=mode) f.getvalue = def_getvalue_maybe_buffered(f,s,self.cipher.decrypt) return f
def makeFile(self,contents,mode): IV = self.cipher.IV if len(contents) % self.cipher.block_size != 0: raise ValueError("content must be multiple of blocksize.") s = StringIO(self.cipher.encrypt(contents)) self.cipher.IV = IV f = Decrypt(s,self.cipher,mode=mode) def trans(val): IV = self.cipher.IV self.cipher.IV = "12345678" val = self.cipher.decrypt(val) self.cipher.IV = IV return val f.getvalue = def_getvalue_maybe_buffered(f,s,trans) return f
def makeFile(self, contents, mode): IV = self.cipher.IV if len(contents) % self.cipher.block_size != 0: raise ValueError("content must be multiple of blocksize.") s = StringIO(self.cipher.encrypt(contents)) self.cipher.IV = IV f = Decrypt(s, self.cipher, mode=mode) def trans(val): IV = self.cipher.IV self.cipher.IV = "12345678" val = self.cipher.decrypt(val) self.cipher.IV = IV return val f.getvalue = def_getvalue_maybe_buffered(f, s, trans) return f