Skip to content

KMSClient.generate_random

rboto-kms==0.4.0 · Service index · Types

Model summary (excerpt): Returns a random byte string that is cryptographically secure. You must use the NumberOfBytes parameter to specify the length of the random byte string. There is no default value for string length. By default, the random byte string is generated in KMS. To generate the byte string in the CloudHSM cluster associated with an CloudHSM key store, use the CustomKeyStoreId parameter. GenerateRandom...

Install and imports

python -m pip install "rboto[kms]==0.4.0"
from rboto import KMSClient
from rboto_kms.types import (
    GenerateRandomOutput,
    RecipientInfo,
)

Signature

async def generate_random(
    *,
    number_of_bytes: int | None = None,
    custom_key_store_id: str | None = None,
    recipient: RecipientInfo | None = None,
) -> GenerateRandomOutput: ...

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)
number_of_bytes No The length of the random byte string. This parameter is required.
custom_key_store_id No Generates the random byte string in the CloudHSM cluster that is associated with the specified CloudHSM key store. To find the ID of a custom key store, use the DescribeCustomKeyStores operation. External key store IDs are not valid for this parameter. If you specify the ID of an external key store, GenerateRandom throws an UnsupportedOperationException .
recipient No A signed attestation document from an Amazon Web Services Nitro enclave or NitroTPM, and the encryption algorithm to use with the public key in the attestation document. The only valid encryption algorithm is RSAES_OAEP_SHA_256 . This parameter supports the Amazon Web Services Nitro Enclaves SDK or any Amazon Web Services SDK for Amazon Web Services Nitro Enclaves. It supports any Amazon Web...

Output

GenerateRandomOutput.

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
plaintext bytes | None Always present —
ciphertext_for_recipient bytes | None Always present —

| 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.

GenerateRandomOutput, RecipientInfo

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:

CustomKeyStoreInvalidStateError, CustomKeyStoreNotFoundError, DependencyTimeoutError, KMSInternalError, UnsupportedOperationError.

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

Service guide · Pinned model