1. /*
  2. * @(#)SecureRandomSpi.java 1.11 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.security;
  8. /**
  9. * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
  10. * for the <code>SecureRandom</code> class.
  11. * All the abstract methods in this class must be implemented by each
  12. * service provider who wishes to supply the implementation
  13. * of a cryptographically strong pseudo-random number generator.
  14. *
  15. * @version 1.11, 12/19/03
  16. *
  17. * @see SecureRandom
  18. * @since 1.2
  19. */
  20. public abstract class SecureRandomSpi implements java.io.Serializable {
  21. private static final long serialVersionUID = -2991854161009191830L;
  22. /**
  23. * Reseeds this random object. The given seed supplements, rather than
  24. * replaces, the existing seed. Thus, repeated calls are guaranteed
  25. * never to reduce randomness.
  26. *
  27. * @param seed the seed.
  28. */
  29. protected abstract void engineSetSeed(byte[] seed);
  30. /**
  31. * Generates a user-specified number of random bytes.
  32. *
  33. * @param bytes the array to be filled in with random bytes.
  34. */
  35. protected abstract void engineNextBytes(byte[] bytes);
  36. /**
  37. * Returns the given number of seed bytes. This call may be used to
  38. * seed other random number generators.
  39. *
  40. * @param numBytes the number of seed bytes to generate.
  41. *
  42. * @return the seed bytes.
  43. */
  44. protected abstract byte[] engineGenerateSeed(int numBytes);
  45. }