Edit

Share via


MLKem.Decapsulate Method

Definition

Overloads

Decapsulate(Byte[])

Decapsulates a shared secret from a provided ciphertext.

Decapsulate(ReadOnlySpan<Byte>, Span<Byte>)

Decapsulates a shared secret from a provided ciphertext.

Decapsulate(Byte[])

Source:
MLKem.cs
Source:
MLKem.cs

Decapsulates a shared secret from a provided ciphertext.

public:
 cli::array <System::Byte> ^ Decapsulate(cli::array <System::Byte> ^ ciphertext);
public byte[] Decapsulate(byte[] ciphertext);
member this.Decapsulate : byte[] -> byte[]
Public Function Decapsulate (ciphertext As Byte()) As Byte()

Parameters

ciphertext
Byte[]

The ciphertext.

Returns

Byte[]

The shared secret.

Exceptions

An error occurred during decapsulation.

ciphertext is not the correct size.

ciphertext is null.

The object has already been disposed.

Remarks

Decapsulation can only decapsulate a shared secret created with the the decapsulation key's corresponding encapsulation key. If a different key is used, ML-KEM performs implicit rejection.

Implicit rejection means an error will not be returned. Instead, the shared secret will be a deterministic but incorrect result.

Detecting incorrect key use is a concern for consumers of the ML-KEM algorithm.

For more information, see FIPS 203, Section 6.3.

Applies to

Decapsulate(ReadOnlySpan<Byte>, Span<Byte>)

Source:
MLKem.cs
Source:
MLKem.cs

Decapsulates a shared secret from a provided ciphertext.

public:
 void Decapsulate(ReadOnlySpan<System::Byte> ciphertext, Span<System::Byte> sharedSecret);
public void Decapsulate(ReadOnlySpan<byte> ciphertext, Span<byte> sharedSecret);
member this.Decapsulate : ReadOnlySpan<byte> * Span<byte> -> unit
Public Sub Decapsulate (ciphertext As ReadOnlySpan(Of Byte), sharedSecret As Span(Of Byte))

Parameters

ciphertext
ReadOnlySpan<Byte>

The ciphertext.

sharedSecret
Span<Byte>

The buffer to receive the shared secret.

Exceptions

An error occurred during decapsulation.

ciphertext is not the correct size.

-or-

sharedSecret is not the correct size.

The object has already been disposed.

Remarks

Decapsulation can only decapsulate a shared secret created with the the decapsulation key's corresponding encapsulation key. If a different key is used, ML-KEM performs implicit rejection.

Implicit rejection means an error will not be returned. Instead, the shared secret will be a deterministic but incorrect result.

Detecting incorrect key use is a concern for consumers of the ML-KEM algorithm.

For more information, see FIPS 203, Section 6.3.

Applies to