Generate a random initialization vector.
(self)
| 324 | (len(key), self.key_size)) |
| 325 | |
| 326 | def generate_iv(self): |
| 327 | """ |
| 328 | Generate a random initialization vector. |
| 329 | """ |
| 330 | # XXX: Handle counter modes with real counters? RFCs allow the use of |
| 331 | # XXX: random bytes for counters, so it is not wrong to do it that way |
| 332 | return os.urandom(self.iv_size) |
| 333 | |
| 334 | @crypto_validator |
| 335 | def new_cipher(self, key, mode_iv, digest=None): |