KeyAgreementSpi.EngineGenerateSecret Method

Definition

Overloads

EngineGenerateSecret()

Generates the shared secret and returns it in a new buffer.

EngineGenerateSecret(String)

Creates the shared secret and returns it as a secret key object of the requested algorithm type.

EngineGenerateSecret(Byte[], Int32)

Generates the shared secret, and places it into the buffer sharedSecret, beginning at offset inclusive.

EngineGenerateSecret()

Generates the shared secret and returns it in a new buffer.

[Android.Runtime.Register("engineGenerateSecret", "()[B", "GetEngineGenerateSecretHandler")]
protected abstract byte[]? EngineGenerateSecret ();
[<Android.Runtime.Register("engineGenerateSecret", "()[B", "GetEngineGenerateSecretHandler")>]
abstract member EngineGenerateSecret : unit -> byte[]

Returns

Byte[]

the new buffer with the shared secret

Attributes

Exceptions

if this key agreement is not complete.

Remarks

Generates the shared secret and returns it in a new buffer.

This method resets this KeyAgreementSpi object, so that it can be reused for further key agreements. Unless this key agreement is reinitialized with one of the engineInit methods, the same private information and algorithm parameters will be used for subsequent key agreements.

Java documentation for javax.crypto.KeyAgreementSpi.engineGenerateSecret().

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

EngineGenerateSecret(String)

Creates the shared secret and returns it as a secret key object of the requested algorithm type.

[Android.Runtime.Register("engineGenerateSecret", "(Ljava/lang/String;)Ljavax/crypto/SecretKey;", "GetEngineGenerateSecret_Ljava_lang_String_Handler")]
protected abstract Javax.Crypto.ISecretKey? EngineGenerateSecret (string? algorithm);
[<Android.Runtime.Register("engineGenerateSecret", "(Ljava/lang/String;)Ljavax/crypto/SecretKey;", "GetEngineGenerateSecret_Ljava_lang_String_Handler")>]
abstract member EngineGenerateSecret : string -> Javax.Crypto.ISecretKey

Parameters

algorithm
String

the requested secret key algorithm

Returns

the shared secret key

Attributes

Exceptions

if this key agreement is not complete.

if the specified algorithm for the secret key does not exists.

if a SecretKey with the specified algorithm cannot be created using the generated shared secret.

Remarks

Creates the shared secret and returns it as a secret key object of the requested algorithm type.

This method resets this KeyAgreementSpi object, so that it can be reused for further key agreements. Unless this key agreement is reinitialized with one of the engineInit methods, the same private information and algorithm parameters will be used for subsequent key agreements.

Java documentation for javax.crypto.KeyAgreementSpi.engineGenerateSecret(java.lang.String).

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

EngineGenerateSecret(Byte[], Int32)

Generates the shared secret, and places it into the buffer sharedSecret, beginning at offset inclusive.

[Android.Runtime.Register("engineGenerateSecret", "([BI)I", "GetEngineGenerateSecret_arrayBIHandler")]
protected abstract int EngineGenerateSecret (byte[]? sharedSecret, int offset);
[<Android.Runtime.Register("engineGenerateSecret", "([BI)I", "GetEngineGenerateSecret_arrayBIHandler")>]
abstract member EngineGenerateSecret : byte[] * int -> int

Parameters

sharedSecret
Byte[]

the buffer for the shared secret

offset
Int32

the offset in sharedSecret where the shared secret will be stored

Returns

the number of bytes placed into sharedSecret

Attributes

Exceptions

if this key agreement is not complete.

if the specified buffer is too small for the shared secret.

Remarks

Generates the shared secret, and places it into the buffer sharedSecret, beginning at offset inclusive.

If the sharedSecret buffer is too small to hold the result, a ShortBufferException is thrown. In this case, this call should be repeated with a larger output buffer.

This method resets this KeyAgreementSpi object, so that it can be reused for further key agreements. Unless this key agreement is reinitialized with one of the engineInit methods, the same private information and algorithm parameters will be used for subsequent key agreements.

Java documentation for javax.crypto.KeyAgreementSpi.engineGenerateSecret(byte[], int).

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