The SecureRandom Class:
The
SecureRandom class in this provider is a hardware-device-based random number
generator and some devices do not support seeding. Therefore, calls to setSeed,
getSeed and generateSeed might throw an exception. Note: that an
alias for the algorithm name PKCS11DeviceRNG has been added as IBMSecureRandom for compatibility
reasons.
Example of
SecureRandom usage
java.security.SecureRandom random = null;
// Could replace PKCS11DeviceRNG with IBMSecureRandom
random = java.security.SecureRandom.getInstance("PKCS11DeviceRNG");
byte[] testData = new byte[1024];
random.nextBytes(testData);
In this example an instance of the SecureRandom class
is obtained, a byte array is instantiated, and a random number of
size 1024 bytes is generated.
See the Java™ API documentation for the specific methods, default values, and restrictions associated with this class.