Stay organized with collections
Save and categorize content based on your preferences.
AlgorithmParameterGeneratorSpi
abstract class AlgorithmParameterGeneratorSpi
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.
Summary
Protected methods |
abstract AlgorithmParameters! |
Generates the parameters.
|
abstract Unit |
Initializes this parameter generator for a certain size and source of randomness.
|
abstract Unit |
Initializes this parameter generator with a set of algorithm-specific parameter generation values.
|
Public constructors
AlgorithmParameterGeneratorSpi
AlgorithmParameterGeneratorSpi()
Protected methods
engineGenerateParameters
protected abstract fun engineGenerateParameters(): AlgorithmParameters!
Generates the parameters.
engineInit
protected abstract fun engineInit(
size: Int,
random: SecureRandom!
): Unit
Initializes this parameter generator for a certain size and source of randomness.
Parameters |
size |
Int: the size (number of bits). |
random |
SecureRandom!: the source of randomness. |
engineInit
protected abstract fun engineInit(
genParamSpec: AlgorithmParameterSpec!,
random: SecureRandom!
): Unit
Initializes this parameter generator with a set of algorithm-specific parameter generation values.
Exceptions |
java.security.InvalidAlgorithmParameterException |
if the given parameter generation values are inappropriate for this parameter generator. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# AlgorithmParameterGeneratorSpi\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nAlgorithmParameterGeneratorSpi\n==============================\n\n```\nabstract class AlgorithmParameterGeneratorSpi\n```\n\n|---|---------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [java.security.AlgorithmParameterGeneratorSpi](#) |\n\nThis 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.\n\nAll 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.\n\nIn 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.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------|---|\n| [AlgorithmParameterGeneratorSpi](#AlgorithmParameterGeneratorSpi())`()` \u003cbr /\u003e |\n\n| Protected methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [AlgorithmParameters](/reference/kotlin/java/security/AlgorithmParameters)! | [engineGenerateParameters](#engineGenerateParameters())`()` Generates the parameters. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [engineInit](#engineInit(kotlin.Int,%20java.security.SecureRandom))`(`size:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `random:` `[SecureRandom](/reference/kotlin/java/security/SecureRandom)!`)` Initializes this parameter generator for a certain size and source of randomness. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [engineInit](#engineInit(java.security.spec.AlgorithmParameterSpec,%20java.security.SecureRandom))`(`genParamSpec:` `[AlgorithmParameterSpec](/reference/kotlin/java/security/spec/AlgorithmParameterSpec)!`, `random:` `[SecureRandom](/reference/kotlin/java/security/SecureRandom)!`)` Initializes this parameter generator with a set of algorithm-specific parameter generation values. |\n\nPublic constructors\n-------------------\n\n### AlgorithmParameterGeneratorSpi\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nAlgorithmParameterGeneratorSpi()\n```\n\nProtected methods\n-----------------\n\n### engineGenerateParameters\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected abstract fun engineGenerateParameters(): AlgorithmParameters!\n```\n\nGenerates the parameters.\n\n| Return ||\n|-----------------------------------------------------------------------------|-------------------------------------|\n| [AlgorithmParameters](/reference/kotlin/java/security/AlgorithmParameters)! | the new AlgorithmParameters object. |\n\n### engineInit\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected abstract fun engineInit(\n size: Int, \n random: SecureRandom!\n): Unit\n```\n\nInitializes this parameter generator for a certain size and source of randomness.\n\n| Parameters ||\n|----------|--------------------------------------------------------------------------------------------------------|\n| `size` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the size (number of bits). |\n| `random` | [SecureRandom](/reference/kotlin/java/security/SecureRandom)!: the source of randomness. |\n\n### engineInit\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected abstract fun engineInit(\n genParamSpec: AlgorithmParameterSpec!, \n random: SecureRandom!\n): Unit\n```\n\nInitializes this parameter generator with a set of algorithm-specific parameter generation values.\n\n| Parameters ||\n|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `genParamSpec` | [AlgorithmParameterSpec](/reference/kotlin/java/security/spec/AlgorithmParameterSpec)!: the set of algorithm-specific parameter generation values. |\n| `random` | [SecureRandom](/reference/kotlin/java/security/SecureRandom)!: the source of randomness. |\n\n| Exceptions ||\n|----------------------------------------------------|------------------------------------------------------------------------------------------|\n| `java.security.InvalidAlgorithmParameterException` | if the given parameter generation values are inappropriate for this parameter generator. |"]]