Package java.security

Class AlgorithmParameterGenerator


  • public class AlgorithmParameterGenerator
    extends Object
    AlgorithmParameterGenerator is an engine class which is capable of generating parameters for the algorithm it was initialized with.
    • Constructor Detail

      • AlgorithmParameterGenerator

        protected AlgorithmParameterGenerator​(AlgorithmParameterGeneratorSpi paramGenSpi,
                                              Provider provider,
                                              String algorithm)
        Constructs a new instance of AlgorithmParameterGenerator with the given arguments.
        Parameters:
        paramGenSpi - a concrete implementation, this engine instance delegates to.
        provider - the provider.
        algorithm - the name of the algorithm.
    • Method Detail

      • getAlgorithm

        public final String getAlgorithm()
        Returns the name of the algorithm.
        Returns:
        the name of the algorithm.
      • getInstance

        public static AlgorithmParameterGenerator getInstance​(String algorithm,
                                                              Provider provider)
                                                       throws NoSuchAlgorithmException
        Returns a new instance of AlgorithmParameterGenerator from the specified provider for the specified algorithm. The provider supplied does not have to be registered.
        Parameters:
        algorithm - the name of the algorithm to use.
        provider - the provider of the AlgorithmParameterGenerator.
        Returns:
        a new instance of AlgorithmParameterGenerator for the specified algorithm.
        Throws:
        NoSuchAlgorithmException - if the specified algorithm is not available.
        NullPointerException - if algorithm is null.
        IllegalArgumentException - if provider == null
      • getProvider

        public final Provider getProvider()
        Returns the provider associated with this AlgorithmParameterGenerator.
        Returns:
        the provider associated with this AlgorithmParameterGenerator.
      • init

        public final void init​(int size)
        Initializes this AlgorithmParameterGenerator with the given size. The default parameter set and a default SecureRandom instance will be used.
        Parameters:
        size - the size (in number of bits).
      • init

        public final void init​(int size,
                               SecureRandom random)
        Initializes this AlgorithmParameterGenerator with the given size and the given SecureRandom. The default parameter set will be used.
        Parameters:
        size - the size (in number of bits).
        random - the source of randomness.
      • generateParameters

        public final AlgorithmParameters generateParameters()
        Computes and returns AlgorithmParameters for this generator's algorithm.
        Returns:
        AlgorithmParameters for this generator's algorithm.