Save This Page
Home » openjdk-7 » java » security » [javadoc | source]
final class: VMSecureRandom [javadoc | source]
VM-specific methods for generating real (or almost real) random seeds. VM implementors should write a version of this class that reads random bytes from some system source.

The default implementation of this class runs eight threads that increment counters in a tight loop, and XORs each counter to produce one byte of seed data. This is not very efficient, and is not guaranteed to be random (the thread scheduler is probably deterministic, after all). If possible, VM implementors should reimplement this class so it obtains a random seed from a system facility, such as a system entropy gathering device or hardware random number generator.
Nested Class Summary:
static class  VMSecureRandom.Spinner   
Method from Summary:
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from Detail:
 static int generateSeed(byte[] buffer,
    int offset,
    int length) 
    Generate a random seed. Implementations are free to generate fewer random bytes than are requested, and leave the remaining bytes of the destination buffer as zeros. Implementations SHOULD, however, make a best-effort attempt to satisfy the request.