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;
}
\dev\randomwas a TRNG whilstdev\urandomwas a PRNG. – Paul Uszak Dec 24 '21 at 22:03securerandom.source=file:/dev/randomwhich 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). – Paul Uszak Dec 25 '21 at 03:30