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