Given SecureRandom
class is considered suitable for use in cryptography, I consider new SecureRandom()
to be secure (funny term, isn't it?).
If new SecureRandom()
already is secure, what would be the benefit of using SecureRandom.getInstanceStrong()
instead?
Is this same kind of difference as between /dev/urandom
and /dev/random
?
I'm debating this in the following scenario, where I'm mostly concerned about making IV random (for use with AES-GCM):
private final SecureRandom secureRandom = new SecureRandom();
[...]
private byte[] getIv() {
int ivLength = 12;
byte[] iv = new byte[ivLength];
secureRandom.nextBytes(iv);
return iv;
}
securerandom.source=file:/dev/random
which block(ed) of course. So if you spun up an app server, it took like five minutes to return a http request. Even a non https daft one like my site which is pretty surprising (probably cookie generation). $\endgroup$