1. /*
  2. * @(#)SecureRandomSpi.java 1.4 01/11/29
  3. *
  4. * Copyright 2002 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.4 01/11/29
  16. *
  17. * @see SecureRandom
  18. * @since JDK1.2
  19. */
  20. public abstract class SecureRandomSpi implements java.io.Serializable {
  21. /**
  22. * Reseeds this random object. The given seed supplements, rather than
  23. * replaces, the existing seed. Thus, repeated calls are guaranteed
  24. * never to reduce randomness.
  25. *
  26. * @param seed the seed.
  27. */
  28. protected abstract void engineSetSeed(byte[] seed);
  29. /**
  30. * Generates a user-specified number of random bytes.
  31. *
  32. * @param bytes the array to be filled in with random bytes.
  33. */
  34. protected abstract void engineNextBytes(byte[] bytes);
  35. /**
  36. * Returns the given number of seed bytes. This call may be used to
  37. * seed other random number generators.
  38. *
  39. * @param numBytes the number of seed bytes to generate.
  40. *
  41. * @return the seed bytes.
  42. */
  43. protected abstract byte[] engineGenerateSeed(int numBytes);
  44. }