(self, password, method, op, iv)
| 95 | return len(self.cipher_iv) |
| 96 | |
| 97 | def get_cipher(self, password, method, op, iv): |
| 98 | password = common.to_bytes(password) |
| 99 | m = self._method_info |
| 100 | if m[0] > 0: |
| 101 | key, iv_ = EVP_BytesToKey(password, m[0], m[1]) |
| 102 | else: |
| 103 | # key_length == 0 indicates we should use the key directly |
| 104 | key, iv = password, b'' |
| 105 | self.key = key |
| 106 | iv = iv[:m[1]] |
| 107 | if op == 1: |
| 108 | # this iv is for cipher not decipher |
| 109 | self.cipher_iv = iv[:m[1]] |
| 110 | return m[2](method, key, iv, op) |
| 111 | |
| 112 | def encrypt(self, buf): |
| 113 | if len(buf) == 0: |
no test coverage detected