Skip to content

KMSClient.encapsulate

rboto-kms==0.4.0 · Service index · Types

Model summary (excerpt): 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,...

Install and imports

python -m pip install "rboto[kms]==0.4.0"
from rboto import KMSClient
from collections.abc import Sequence
from rboto_kms.types import (
    EncapsulateOutput,
    EncapsulationAlgorithmSpec,
)

Signature

async def encapsulate(
    *,
    key_id: str,
    encapsulation_algorithm: EncapsulationAlgorithmSpec,
    grant_tokens: Sequence[str] | None = None,
    dry_run: bool | None = None,
) -> EncapsulateOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
key_id Yes 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 KeySpec value of ML_KEM_512 , ML_KEM_768 , or ML_KEM_1024 and a KeyUsage value of ENCAPSULATE_DECAPSULATE . To find the KeySpec and KeyUsage of a KMS key, use the DescribeKey operation. To specify a KMS key, use its key ID, key ARN, alias name, or...
encapsulation_algorithm Yes Specifies the key encapsulation algorithm used to generate the shared secret and its encapsulated form. The only valid value is ML_KEM .
grant_tokens No 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 .
dry_run No Checks if your request will succeed. DryRun is an optional parameter. To learn more about how to use this parameter, see Testing your permissions in the Key Management Service Developer Guide .

Output

EncapsulateOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
key_id str | None Always present —
shared_secret bytes | None Always present —
shared_secret_ciphertext_blob bytes | None Always present —
encapsulation_algorithm EncapsulationAlgorithmSpecOutput | None Always present EncapsulationAlgorithmSpecOutput

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

EncapsulateOutput, EncapsulationAlgorithmSpec

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_kms.exceptions:

DependencyTimeoutError, DisabledError, DryRunOperationError, InvalidGrantTokenError, InvalidKeyUsageError, KMSInternalError, KMSInvalidStateError, KeyUnavailableError, NotFoundError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model