예제 #1
0
 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.decrypt(contents))
     f = Encrypt(s, self.cipher, mode=mode)
     f.getvalue = def_getvalue_maybe_buffered(f, s, self.cipher.encrypt)
     return f
예제 #2
0
 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.decrypt(contents))
     f = Encrypt(s,self.cipher,mode=mode)
     f.getvalue = def_getvalue_maybe_buffered(f,s,self.cipher.encrypt)
     return f
예제 #3
0
 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.decrypt(contents))
     self.cipher.IV = IV
     f = Encrypt(s,self.cipher,mode=mode)
     def trans(val):
         IV = self.cipher.IV
         self.cipher.IV = "12345678"
         val = self.cipher.encrypt(val)
         self.cipher.IV = IV
         return val
     f.getvalue = def_getvalue_maybe_buffered(f,s,trans)
     return f
예제 #4
0
    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.decrypt(contents))
        self.cipher.IV = IV
        f = Encrypt(s, self.cipher, mode=mode)

        def trans(val):
            IV = self.cipher.IV
            self.cipher.IV = "12345678"
            val = self.cipher.encrypt(val)
            self.cipher.IV = IV
            return val

        f.getvalue = def_getvalue_maybe_buffered(f, s, trans)
        return f