...
Code Block | ||||
---|---|---|---|---|
| ||||
byte[] randomBytes = new byte[128]; SecureRandom random = new SecureRandom(); random.nextBytes(randomBytes); |
It is also good practice to specify Specifying the exact random number generator RNG algorithm and provider for better portabilitycan improve portability, perhaps when complying with a design or regulation that mandates a particular algorithm. However, if no arguments are provided, the constructor will provide a default secure RNG.
Applicability
Insufficiently secure random numbers enable attackers to gain specific information about the context in which they are used.
...
...