to top
Android APIs
public class

AlgorithmParameterGenerator

extends Object
java.lang.Object
   ↳ java.security.AlgorithmParameterGenerator

Class Overview

AlgorithmParameterGenerator is an engine class which is capable of generating parameters for the algorithm it was initialized with.

Summary

Protected Constructors
AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi paramGenSpi, Provider provider, String algorithm)
Constructs a new instance of AlgorithmParameterGenerator with the given arguments.
Public Methods
final AlgorithmParameters generateParameters()
Computes and returns AlgorithmParameters for this generator's algorithm.
final String getAlgorithm()
Returns the name of the algorithm.
static AlgorithmParameterGenerator getInstance(String algorithm, String provider)
Returns a new instance of AlgorithmParameterGenerator from the specified provider for the specified algorithm.
static AlgorithmParameterGenerator getInstance(String algorithm, Provider provider)
Returns a new instance of AlgorithmParameterGenerator from the specified provider for the specified algorithm.
static AlgorithmParameterGenerator getInstance(String algorithm)
Returns a new instance of AlgorithmParameterGenerator for the specified algorithm.
final Provider getProvider()
Returns the provider associated with this AlgorithmParameterGenerator.
final void init(AlgorithmParameterSpec genParamSpec, SecureRandom random)
Initializes this AlgorithmParameterGenerator with the given AlgorithmParameterSpec and the given SecureRandom.
final void init(AlgorithmParameterSpec genParamSpec)
Initializes this AlgorithmParameterGenerator with the given AlgorithmParameterSpec.
final void init(int size, SecureRandom random)
Initializes this AlgorithmParameterGenerator with the given size and the given SecureRandom.
final void init(int size)
Initializes this AlgorithmParameterGenerator with the given size.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected AlgorithmParameterGenerator (AlgorithmParameterGeneratorSpi paramGenSpi, Provider provider, String algorithm)

Since: API Level 1

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.

Public Methods

public final AlgorithmParameters generateParameters ()

Since: API Level 1

Computes and returns AlgorithmParameters for this generator's algorithm.

Returns
  • AlgorithmParameters for this generator's algorithm.

public final String getAlgorithm ()

Since: API Level 1

Returns the name of the algorithm.

Returns
  • the name of the algorithm.

public static AlgorithmParameterGenerator getInstance (String algorithm, String provider)

Since: API Level 1

Returns a new instance of AlgorithmParameterGenerator from the specified provider for the specified algorithm.

Parameters
algorithm the name of the algorithm to use.
provider name of the provider of the AlgorithmParameterGenerator.
Returns
  • a new instance of AlgorithmParameterGenerator for the specified algorithm.
Throws
NoSuchAlgorithmException if the specified algorithm is not available.
NoSuchProviderException if the specified provider is not available.
IllegalArgumentException if provider == null || provider.isEmpty()
NullPointerException if algorithm is null.

public static AlgorithmParameterGenerator getInstance (String algorithm, Provider provider)

Since: API Level 1

Returns a new instance of AlgorithmParameterGenerator from the specified provider for the specified algorithm.

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

public static AlgorithmParameterGenerator getInstance (String algorithm)

Since: API Level 1

Returns a new instance of AlgorithmParameterGenerator for the specified algorithm.

Parameters
algorithm the name of the algorithm to use.
Returns
  • a new instance of AlgorithmParameterGenerator for the specified algorithm.
Throws
NoSuchAlgorithmException if the specified algorithm is not available.
NullPointerException if algorithm is null.

public final Provider getProvider ()

Since: API Level 1

Returns the provider associated with this AlgorithmParameterGenerator.

Returns
  • the provider associated with this AlgorithmParameterGenerator.

public final void init (AlgorithmParameterSpec genParamSpec, SecureRandom random)

Since: API Level 1

Initializes this AlgorithmParameterGenerator with the given AlgorithmParameterSpec and the given SecureRandom.

Parameters
genParamSpec the parameters to use.
random the source of randomness.
Throws
InvalidAlgorithmParameterException if the specified parameters are not supported.

public final void init (AlgorithmParameterSpec genParamSpec)

Since: API Level 1

Initializes this AlgorithmParameterGenerator with the given AlgorithmParameterSpec. A default SecureRandom instance will be used.

Parameters
genParamSpec the parameters to use.
Throws
InvalidAlgorithmParameterException if the specified parameters are not supported.

public final void init (int size, SecureRandom random)

Since: API Level 1

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.

public final void init (int size)

Since: API Level 1

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).