For a stream cipher to be secure against repeated key attacks the IV's should not repeat themselves. But does SecureRandom have a benefit over a simple non-secure Random in that respect (or is it just for generating an unpredictable sequence)?
Assuming I'm using fixed sized messages with AES CBC mode and I generate a new Random for each IV (using the current nano time as seed) does this increase the probability of repeating IV compared to a SecureRandom?
The biggest problem with using Random
to generate your IV is not that it is likely to repeat, but that an attacker can predict future IVs, and this can be used to attack CBC.
Related: https://crypto.stackexchange.com/q/3515/2805
Random uses 48-bit key so it will repeat approx every 2^48 values. It means not every possible long
will be generated. That may or may not be random enough for you. If in doubt use SecureRandom, you can always change it later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With