Skip to content

KMSClient.generate_data_key_pair

rboto-kms==0.4.0 · Service index · Types

Model summary (excerpt): Returns a unique asymmetric data key pair for use outside of KMS. This operation returns a plaintext public key, a plaintext private key, and a copy of the private key that is encrypted under the symmetric encryption KMS key you specify. You can use the data key pair to perform asymmetric cryptography and implement digital signatures outside of KMS. The bytes in the keys are random; they are...

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 (
    DataKeyPairSpec,
    GenerateDataKeyPairOutput,
    RecipientInfo,
)

Signature

async def generate_data_key_pair(
    *,
    key_id: str,
    key_pair_spec: DataKeyPairSpec,
    encryption_context: dict[str, str] | None = None,
    grant_tokens: Sequence[str] | None = None,
    recipient: RecipientInfo | None = None,
    dry_run: bool | None = None,
) -> GenerateDataKeyPairOutput: ...

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 Specifies the symmetric encryption KMS key that encrypts the private key in the data key pair. You cannot specify an asymmetric KMS key or a KMS key in a custom key store. To get the type and origin of your KMS key, use the DescribeKey operation. To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with "alias/" . To specify a KMS key in...
key_pair_spec Yes Determines the type of data key pair that is generated. The KMS rule that restricts the use of asymmetric RSA and SM2 KMS keys to encrypt and decrypt or to sign and verify (but not both), the rule that permits you to use ECC KMS keys only to sign and verify, and the rule that permits you to use ML-DSA key pairs to sign and verify only are not effective on data key pairs, which are used outside...
encryption_context No Specifies the encryption context that will be used when encrypting the private key in the data key pair. Do not include confidential or sensitive information in this field. This field may be displayed in plaintext in CloudTrail logs and other output. An encryption context is a collection of non-secret key-value pairs that represent additional authenticated data. When you use an encryption...
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 .
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 only supports attestation documents for Amazon Web Services Nitro Enclaves or Amazon Web Services NitroTPM. To call GenerateDataKeyPair generate an...
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

GenerateDataKeyPairOutput.

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
private_key_ciphertext_blob bytes | None Always present —
private_key_plaintext bytes | None Always present —
public_key bytes | None Always present —
key_id str | None Always present —
key_pair_spec DataKeyPairSpecOutput | None Always present DataKeyPairSpecOutput
ciphertext_for_recipient bytes | None Always present —
key_material_id str | 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.

DataKeyPairSpec, GenerateDataKeyPairOutput, 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:

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

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

Service guide · Pinned model