Class DefaultSecureRandomService

java.lang.Object
com.atlassian.security.random.DefaultSecureRandomService
All Implemented Interfaces:
SecureRandomService

public final class DefaultSecureRandomService extends Object implements SecureRandomService
Implementation of the SecureRandomService which delegates to a single, shared instance of SecureRandom.

Potential improvements include:

  • Periodic Re-seeding: currently we are not sure if this is a requirement, so it has not been implemented.
  • Object Pooling: as SecureRandoms block on calls to produce random data, we may improve throughput by pooling a collection of SecureRandoms. Contention is not yet been proved to be a problem, so it has not been implemented.

The current implementation is guaranteed to be thread-safe as it delegates calls to the underlying SecureRandom instance.