コード例 #1
0
ファイル: test_crypto.py プロジェクト: verybada/filelike
 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
コード例 #2
0
ファイル: test_crypto.py プロジェクト: TimothyFitz/filelike
 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
コード例 #3
0
ファイル: test_crypto.py プロジェクト: TimothyFitz/filelike
 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
コード例 #4
0
ファイル: test_crypto.py プロジェクト: verybada/filelike
    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