Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/java/security/AlgorithmParameterGeneratorSpi#pubctors) \| [Protected Methods](https://developer.android.com/reference/java/security/AlgorithmParameterGeneratorSpi#promethods) \| [Inherited Methods](https://developer.android.com/reference/java/security/AlgorithmParameterGeneratorSpi#inhmethods)

# AlgorithmParameterGeneratorSpi

` public abstract class AlgorithmParameterGeneratorSpi `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.security.AlgorithmParameterGeneratorSpi |

<br />

*** ** * ** ***

This class defines the *Service Provider Interface* (**SPI** ) for the `AlgorithmParameterGenerator` class, which is used to generate a set of parameters to be used with a certain algorithm.

All the abstract methods in this class must be implemented by each cryptographic service provider who wishes to supply the implementation of a parameter generator for a particular algorithm.

In case the client does not explicitly initialize the AlgorithmParameterGenerator (via a call to an `engineInit` method), each provider must supply (and document) a default initialization. However, note that defaults may vary across different providers. Additionally, the default value for a provider may change in a future version. Therefore, it is recommended to explicitly initialize the AlgorithmParameterGenerator instead of relying on provider-specific defaults.
**See also:**

- `https://developer.android.com/reference/java/security/AlgorithmParameterGenerator`
- `https://developer.android.com/reference/java/security/AlgorithmParameters`
- `https://developer.android.com/reference/java/security/spec/AlgorithmParameterSpec`

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/java/security/AlgorithmParameterGeneratorSpi#AlgorithmParameterGeneratorSpi()() ` |

| ### Protected methods ||
|---|---|
| ` abstract https://developer.android.com/reference/java/security/AlgorithmParameters` | ` https://developer.android.com/reference/java/security/AlgorithmParameterGeneratorSpi#engineGenerateParameters()() ` Generates the parameters. |
| ` abstract void` | ` https://developer.android.com/reference/java/security/AlgorithmParameterGeneratorSpi#engineInit(java.security.spec.AlgorithmParameterSpec,%20java.security.SecureRandom)(https://developer.android.com/reference/java/security/spec/AlgorithmParameterSpec genParamSpec, https://developer.android.com/reference/java/security/SecureRandom random) ` Initializes this parameter generator with a set of algorithm-specific parameter generation values. |
| ` abstract void` | ` https://developer.android.com/reference/java/security/AlgorithmParameterGeneratorSpi#engineInit(int,%20java.security.SecureRandom)(int size, https://developer.android.com/reference/java/security/SecureRandom random) ` Initializes this parameter generator for a certain size and source of randomness. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### AlgorithmParameterGeneratorSpi

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public AlgorithmParameterGeneratorSpi ()
```

<br />

<br />

## Protected methods

### engineGenerateParameters

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected abstract AlgorithmParameters engineGenerateParameters ()
```

Generates the parameters.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/security/AlgorithmParameters` | the new AlgorithmParameters object. <br /> |

### engineInit

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected abstract void engineInit (AlgorithmParameterSpec genParamSpec, 
                SecureRandom random)
```

Initializes this parameter generator with a set of algorithm-specific parameter generation values.

<br />

| Parameters ||
|---|---|
| `genParamSpec` | `AlgorithmParameterSpec`: the set of algorithm-specific parameter generation values. <br /> |
| `random` | `SecureRandom`: the source of randomness. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/security/InvalidAlgorithmParameterException` | if the given parameter generation values are inappropriate for this parameter generator. |

### engineInit

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected abstract void engineInit (int size, 
                SecureRandom random)
```

Initializes this parameter generator for a certain size and source of randomness.

<br />

| Parameters ||
|---|---|
| `size` | `int`: the size (number of bits). <br /> |
| `random` | `SecureRandom`: the source of randomness. <br /> |