1. /*
  2. * @(#)AlgorithmParameterGeneratorSpi.java 1.11 00/02/02
  3. *
  4. * Copyright 1997-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. import java.security.spec.AlgorithmParameterSpec;
  12. /**
  13. * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
  14. * for the <code>AlgorithmParameterGenerator</code> class, which
  15. * is used to generate a set of parameters to be used with a certain algorithm.
  16. *
  17. * <p> All the abstract methods in this class must be implemented by each
  18. * cryptographic service provider who wishes to supply the implementation
  19. * of a parameter generator for a particular algorithm.
  20. *
  21. * <p> In case the client does not explicitly initialize the
  22. * AlgorithmParameterGenerator (via a call to an <code>engineInit</code>
  23. * method), each provider must supply (and document) a default initialization.
  24. * For example, the Sun provider uses a default modulus prime size of 1024
  25. * bits for the generation of DSA parameters.
  26. *
  27. * @author Jan Luehe
  28. *
  29. * @version 1.11, 02/02/00
  30. *
  31. * @see AlgorithmParameterGenerator
  32. * @see AlgorithmParameters
  33. * @see java.security.spec.AlgorithmParameterSpec
  34. *
  35. * @since 1.2
  36. */
  37. public abstract class AlgorithmParameterGeneratorSpi {
  38. /**
  39. * Initializes this parameter generator for a certain size
  40. * and source of randomness.
  41. *
  42. * @param size the size (number of bits).
  43. * @param random the source of randomness.
  44. */
  45. protected abstract void engineInit(int size, SecureRandom random);
  46. /**
  47. * Initializes this parameter generator with a set of
  48. * algorithm-specific parameter generation values.
  49. *
  50. * @param genParamSpec the set of algorithm-specific parameter generation values.
  51. * @param random the source of randomness.
  52. *
  53. * @exception InvalidAlgorithmParameterException if the given parameter
  54. * generation values are inappropriate for this parameter generator.
  55. */
  56. protected abstract void engineInit(AlgorithmParameterSpec genParamSpec,
  57. SecureRandom random)
  58. throws InvalidAlgorithmParameterException;
  59. /**
  60. * Generates the parameters.
  61. *
  62. * @return the new AlgorithmParameters object.
  63. */
  64. protected abstract AlgorithmParameters engineGenerateParameters();
  65. }