AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Container for the parameters to the Decapsulate operation. Recovers the shared secret that was encapsulated with the public key of an ML-KEM KMS key. Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM), specified in FIPS 203 on the NIST website, is a post-quantum algorithm for establishing a shared secret between two parties. For an example of how two parties establish a shared secret over an insecure channel using ML-KEM, see ML-KEM keys in KMS in the Key Management Service Developer Guide.
The Decapsulate operation is not available in China Regions.
Decapsulate returns
the shared secret as a 32-byte value. You can use it directly as key material, or
run it through a key derivation function to derive multiple keys and nonces.
Decapsulate returns an InvalidCiphertextException
when the length of the SharedSecretCiphertextBlob is inconsistent with the
ML-KEM key spec. In all other cases, Decapsulate returns a 32-byte pseudo-random
value. This is true even when the SharedSecretCiphertextBlob was created using
a different ML-KEM key or altered from its original value. This behavior is a security
feature called implicit rejection that helps protect against chosen-ciphertext
attacks.
Because a response does not indicate that the ciphertext and key are valid, confirm the two parties derived the same shared secret before using it.
The KMS key that you use for this operation must be in a compatible key state. For details, see Key states of KMS keys in the Key Management Service Developer Guide.
Cross-account use: Yes. To perform this operation with a KMS key in
a different Amazon Web Services account, specify the key ARN or alias ARN in the value
of the KeyId parameter.
Required permissions: kms:Decapsulate (key policy)
Related operations:
Eventual consistency: The KMS API follows an eventual consistency model. For more information, see KMS eventual consistency.
Namespace: Amazon.KeyManagementService.Model
Assembly: AWSSDK.KeyManagementService.dll
Version: 3.x.y.z
public class DecapsulateRequest : AmazonKeyManagementServiceRequest IAmazonWebServiceRequest
The DecapsulateRequest type exposes the following members
| Name | Description | |
|---|---|---|
|
DecapsulateRequest() |
| Name | Type | Description | |
|---|---|---|---|
|
DryRun | System.Nullable<System.Boolean> |
Gets and sets the property DryRun.
Checks if your request will succeed. To learn more about how to use this parameter, see Testing your permissions in the Key Management Service Developer Guide. |
|
EncapsulationAlgorithm | Amazon.KeyManagementService.EncapsulationAlgorithmSpec |
Gets and sets the property EncapsulationAlgorithm.
Specifies the key encapsulation algorithm used to recover the shared secret. The only
valid value is |
|
GrantTokens | System.Collections.Generic.List<System.String> |
Gets and sets the property GrantTokens. A list of grant tokens. Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the Key Management Service Developer Guide. Starting with version 4 of the SDK this property will default to null. If no data for this property is returned from the service the property will also be null. This was changed to improve performance and allow the SDK and caller to distinguish between a property not set or a property being empty to clear out a value. To retain the previous SDK behavior set the AWSConfigs.InitializeCollections static property to true. |
|
KeyId | System.String |
Gets and sets the property KeyId. Identifies the asymmetric ML-KEM KMS key whose public key was used to produce the encapsulated shared secret. KMS uses the private key in the specified key pair to decapsulate the shared secret.
To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using
an alias name, prefix it with For example:
To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases. |
|
SharedSecretCiphertextBlob | System.IO.MemoryStream |
Gets and sets the property SharedSecretCiphertextBlob.
The encapsulated (ciphertext) form of the shared secret to recover. This is the |
Recovers a shared secret from its encapsulated ciphertext (SharedSecretCiphertextBlob) using the private key in an asymmetric ML-KEM KMS key. Your peer calls Encapsulate to generate the shared secret and ciphertext.
var client = new AmazonKeyManagementServiceClient();
var response = client.Decapsulate(new DecapsulateRequest
{
EncapsulationAlgorithm = "ML_KEM",
KeyId = "1234abcd-12ab-34cd-56ef-1234567890ab",
SharedSecretCiphertextBlob = new MemoryStream(<binary data>)
});
EncapsulationAlgorithmSpec encapsulationAlgorithm = response.EncapsulationAlgorithm;
string keyId = response.KeyId;
MemoryStream sharedSecret = response.SharedSecret;
.NET:
Supported in: 8.0 and newer
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.7.2 and newer