Share via


CipherSpi.EngineInit Method

Definition

Overloads

EngineInit(Int32, IKey, AlgorithmParameters, SecureRandom)

Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness.

EngineInit(Int32, IKey, IAlgorithmParameterSpec, SecureRandom)

Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness.

EngineInit(Int32, IKey, SecureRandom)

Initializes this cipher with a key and a source of randomness.

EngineInit(Int32, IKey, AlgorithmParameters, SecureRandom)

Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness.

[Android.Runtime.Register("engineInit", "(ILjava/security/Key;Ljava/security/AlgorithmParameters;Ljava/security/SecureRandom;)V", "GetEngineInit_ILjava_security_Key_Ljava_security_AlgorithmParameters_Ljava_security_SecureRandom_Handler")]
protected abstract void EngineInit (int opmode, Java.Security.IKey? key, Java.Security.AlgorithmParameters? params, Java.Security.SecureRandom? random);
[<Android.Runtime.Register("engineInit", "(ILjava/security/Key;Ljava/security/AlgorithmParameters;Ljava/security/SecureRandom;)V", "GetEngineInit_ILjava_security_Key_Ljava_security_AlgorithmParameters_Ljava_security_SecureRandom_Handler")>]
abstract member EngineInit : int * Java.Security.IKey * Java.Security.AlgorithmParameters * Java.Security.SecureRandom -> unit

Parameters

opmode
Int32

the operation mode of this cipher (this is one of the following: ENCRYPT_MODE, DECRYPT_MODE, WRAP_MODE or UNWRAP_MODE)

key
IKey

the encryption key

params
AlgorithmParameters

the algorithm parameters

random
SecureRandom

the source of randomness

Attributes

Exceptions

if the specified key cannot be used to initialize this cipher instance.

if the specified parameters are inappropriate for this cipher.

Remarks

Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness.

The cipher is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires any algorithm parameters and params is null, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidAlgorithmParameterException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using #engineGetParameters() engineGetParameters or #engineGetIV() engineGetIV (if the parameter is an IV).

If this cipher requires algorithm parameters that cannot be derived from the input parameters, and there are no reasonable provider-specific default values, initialization will necessarily fail.

If this cipher (including its underlying feedback or padding scheme) requires any random bytes (e.g., for parameter generation), it will get them from random.

Note that when a Cipher object is initialized, it loses all previously-acquired state. In other words, initializing a Cipher is equivalent to creating a new instance of that Cipher and initializing it.

Java documentation for javax.crypto.CipherSpi.engineInit(int, java.security.Key, java.security.AlgorithmParameters, java.security.SecureRandom).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

EngineInit(Int32, IKey, IAlgorithmParameterSpec, SecureRandom)

Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness.

[Android.Runtime.Register("engineInit", "(ILjava/security/Key;Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/SecureRandom;)V", "GetEngineInit_ILjava_security_Key_Ljava_security_spec_AlgorithmParameterSpec_Ljava_security_SecureRandom_Handler")]
protected abstract void EngineInit (int opmode, Java.Security.IKey? key, Java.Security.Spec.IAlgorithmParameterSpec? params, Java.Security.SecureRandom? random);
[<Android.Runtime.Register("engineInit", "(ILjava/security/Key;Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/SecureRandom;)V", "GetEngineInit_ILjava_security_Key_Ljava_security_spec_AlgorithmParameterSpec_Ljava_security_SecureRandom_Handler")>]
abstract member EngineInit : int * Java.Security.IKey * Java.Security.Spec.IAlgorithmParameterSpec * Java.Security.SecureRandom -> unit

Parameters

opmode
Int32

the operation mode of this cipher (this is one of the following: ENCRYPT_MODE, DECRYPT_MODE, WRAP_MODE or UNWRAP_MODE)

key
IKey

the encryption key

params
IAlgorithmParameterSpec

the algorithm parameters

random
SecureRandom

the source of randomness

Attributes

Exceptions

if the specified key cannot be used to initialize this cipher instance.

it the specified parameters are inappropriate for this cipher.

Remarks

Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness.

The cipher is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires any algorithm parameters and params is null, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidAlgorithmParameterException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using #engineGetParameters() engineGetParameters or #engineGetIV() engineGetIV (if the parameter is an IV).

If this cipher requires algorithm parameters that cannot be derived from the input parameters, and there are no reasonable provider-specific default values, initialization will necessarily fail.

If this cipher (including its underlying feedback or padding scheme) requires any random bytes (e.g., for parameter generation), it will get them from random.

Note that when a Cipher object is initialized, it loses all previously-acquired state. In other words, initializing a Cipher is equivalent to creating a new instance of that Cipher and initializing it.

Java documentation for javax.crypto.CipherSpi.engineInit(int, java.security.Key, java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

EngineInit(Int32, IKey, SecureRandom)

Initializes this cipher with a key and a source of randomness.

[Android.Runtime.Register("engineInit", "(ILjava/security/Key;Ljava/security/SecureRandom;)V", "GetEngineInit_ILjava_security_Key_Ljava_security_SecureRandom_Handler")]
protected abstract void EngineInit (int opmode, Java.Security.IKey? key, Java.Security.SecureRandom? random);
[<Android.Runtime.Register("engineInit", "(ILjava/security/Key;Ljava/security/SecureRandom;)V", "GetEngineInit_ILjava_security_Key_Ljava_security_SecureRandom_Handler")>]
abstract member EngineInit : int * Java.Security.IKey * Java.Security.SecureRandom -> unit

Parameters

opmode
Int32

the operation mode of this cipher (this is one of the following: ENCRYPT_MODE, DECRYPT_MODE, WRAP_MODE or UNWRAP_MODE)

key
IKey

the encryption key

random
SecureRandom

the source of randomness

Attributes

Exceptions

if the specified key cannot be used to initialize this cipher instance.

Remarks

Initializes this cipher with a key and a source of randomness.

The cipher is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

If this cipher requires any algorithm parameters that cannot be derived from the given key, the underlying cipher implementation is supposed to generate the required parameters itself (using provider-specific default or random values) if it is being initialized for encryption or key wrapping, and raise an InvalidKeyException if it is being initialized for decryption or key unwrapping. The generated parameters can be retrieved using #engineGetParameters() engineGetParameters or #engineGetIV() engineGetIV (if the parameter is an IV).

If this cipher requires algorithm parameters that cannot be derived from the input parameters, and there are no reasonable provider-specific default values, initialization will necessarily fail.

If this cipher (including its underlying feedback or padding scheme) requires any random bytes (e.g., for parameter generation), it will get them from random.

Note that when a Cipher object is initialized, it loses all previously-acquired state. In other words, initializing a Cipher is equivalent to creating a new instance of that Cipher and initializing it.

Java documentation for javax.crypto.CipherSpi.engineInit(int, java.security.Key, java.security.SecureRandom).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to