SecureRandomSpi
abstract class SecureRandomSpi : Serializable
kotlin.Any | |
↳ | java.security.SecureRandomSpi |
This class defines the Service Provider Interface (SPI) for the SecureRandom
class.
All the abstract methods in this class must be implemented by each service provider who wishes to supply the implementation of a cryptographically strong pseudo-random number generator.
Summary
Public constructors | |
---|---|
Constructor without a parameter. |
Protected constructors | |
---|---|
SecureRandomSpi(params: SecureRandomParameters!) Constructor with a parameter. |
Public methods | |
---|---|
open String |
toString() Returns a Human-readable string representation of this |
Protected methods | |
---|---|
abstract ByteArray! |
engineGenerateSeed(numBytes: Int) Returns the given number of seed bytes. |
open SecureRandomParameters! |
Returns the effective |
abstract Unit |
engineNextBytes(bytes: ByteArray!) Generates a user-specified number of random bytes. |
open Unit |
engineNextBytes(bytes: ByteArray!, params: SecureRandomParameters!) Generates a user-specified number of random bytes with additional parameters. |
open Unit |
engineReseed(params: SecureRandomParameters!) Reseeds this random object with entropy input read from its entropy source with additional parameters. |
abstract Unit |
engineSetSeed(seed: ByteArray!) Reseeds this random object with the given seed. |
Public constructors
Protected constructors
SecureRandomSpi
protected SecureRandomSpi(params: SecureRandomParameters!)
Constructor with a parameter.
Parameters | |
---|---|
params |
SecureRandomParameters!: the SecureRandomParameters object. This argument can be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if params is unrecognizable or unsupported by this SecureRandom |
Public methods
toString
open fun toString(): String
Returns a Human-readable string representation of this SecureRandom
.
Return | |
---|---|
String |
the string representation |
Protected methods
engineGenerateSeed
protected abstract fun engineGenerateSeed(numBytes: Int): ByteArray!
Returns the given number of seed bytes. This call may be used to seed other random number generators.
Parameters | |
---|---|
numBytes |
Int: the number of seed bytes to generate. |
Return | |
---|---|
ByteArray! |
the seed bytes. |
engineGetParameters
protected open fun engineGetParameters(): SecureRandomParameters!
Returns the effective SecureRandomParameters
for this SecureRandom
instance.
Return | |
---|---|
SecureRandomParameters! |
the effective SecureRandomParameters parameters, or null if no parameters were used. |
engineNextBytes
protected abstract fun engineNextBytes(bytes: ByteArray!): Unit
Generates a user-specified number of random bytes.
Some random number generators can only generate a limited amount of random bytes per invocation. If the size of bytes
is greater than this limit, the implementation should invoke its generation process multiple times to completely fill the buffer before returning from this method.
Parameters | |
---|---|
bytes |
ByteArray!: the array to be filled in with random bytes. |
engineNextBytes
protected open fun engineNextBytes(
bytes: ByteArray!,
params: SecureRandomParameters!
): Unit
Generates a user-specified number of random bytes with additional parameters.
Some random number generators can only generate a limited amount of random bytes per invocation. If the size of bytes
is greater than this limit, the implementation should invoke its generation process multiple times to completely fill the buffer before returning from this method.
Parameters | |
---|---|
bytes |
ByteArray!: the array to be filled in with random bytes |
params |
SecureRandomParameters!: additional parameters |
Exceptions | |
---|---|
java.lang.UnsupportedOperationException |
if the implementation has not overridden this method |
java.lang.IllegalArgumentException |
if params is null , illegal or unsupported by this SecureRandom |
engineReseed
protected open fun engineReseed(params: SecureRandomParameters!): Unit
Reseeds this random object with entropy input read from its entropy source with additional parameters.
If this method is called by SecureRandom#reseed()
, params
will be null
.
Do not override this method if the implementation does not support reseeding.
Parameters | |
---|---|
params |
SecureRandomParameters!: extra parameters, can be null . |
Exceptions | |
---|---|
java.lang.UnsupportedOperationException |
if the implementation has not overridden this method |
java.lang.IllegalArgumentException |
if params is illegal or unsupported by this SecureRandom |
engineSetSeed
protected abstract fun engineSetSeed(seed: ByteArray!): Unit
Reseeds this random object with the given seed. The seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.
Parameters | |
---|---|
seed |
ByteArray!: the seed. |