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 Encapsulate operation. Generates a shared secret and its encapsulated (ciphertext) form using the public key of an ML-KEM KMS key pair. 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 Encapsulate operation is not available in China Regions.
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:Encapsulate (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 EncapsulateRequest : AmazonKeyManagementServiceRequest IAmazonWebServiceRequest
The EncapsulateRequest type exposes the following members
| Name | Description | |
|---|---|---|
|
EncapsulateRequest() |
| 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 generate the shared secret and its
encapsulated form. 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 an asymmetric ML-KEM KMS key. KMS uses the public key in the specified
key pair to encapsulate the shared secret. ML-KEM KMS keys have a
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. |
Generates a shared secret and its encapsulated ciphertext (SharedSecretCiphertextBlob) using the public key in an asymmetric ML-KEM KMS key. Send the ciphertext to your peer, who calls Decapsulate to recover the same shared secret.
var client = new AmazonKeyManagementServiceClient();
var response = client.Encapsulate(new EncapsulateRequest
{
EncapsulationAlgorithm = "ML_KEM",
KeyId = "1234abcd-12ab-34cd-56ef-1234567890ab"
});
EncapsulationAlgorithmSpec encapsulationAlgorithm = response.EncapsulationAlgorithm;
string keyId = response.KeyId;
MemoryStream sharedSecret = response.SharedSecret;
MemoryStream sharedSecretCiphertextBlob = response.SharedSecretCiphertextBlob;
.NET:
Supported in: 8.0 and newer
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.7.2 and newer