Skip to content

KMSClient.derive_shared_secret

rboto-kms==0.4.0 · Service index · Types

Model summary (excerpt): Derives a shared secret using a key agreement algorithm. You must use an asymmetric NIST-standard elliptic curve (ECC) or SM2 (China Regions only) KMS key pair with a KeyUsage value of KEY_AGREEMENT to call DeriveSharedSecret. DeriveSharedSecret uses the Elliptic Curve Cryptography Cofactor Diffie-Hellman Primitive (ECDH) to establish a key agreement between two peers by deriving a shared...

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 (
    DeriveSharedSecretOutput,
    KeyAgreementAlgorithmSpec,
    RecipientInfo,
)

Signature

async def derive_shared_secret(
    *,
    key_id: str,
    key_agreement_algorithm: KeyAgreementAlgorithmSpec,
    public_key: bytes,
    grant_tokens: Sequence[str] | None = None,
    dry_run: bool | None = None,
    recipient: RecipientInfo | None = None,
) -> DeriveSharedSecretOutput: ...

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 NIST-standard ECC or SM2 (China Regions only) KMS key. KMS uses the private key in the specified key pair to derive the shared secret. The key usage of the KMS key must be KEY_AGREEMENT . To find the KeyUsage of a 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...
key_agreement_algorithm Yes Specifies the key agreement algorithm used to derive the shared secret. The only valid value is ECDH .
public_key Yes Specifies the public key in your peer's NIST-standard elliptic curve (ECC) or SM2 (China Regions only) key pair. The public key must be a DER-encoded X.509 public key, also known as SubjectPublicKeyInfo (SPKI), as defined in RFC 5280 . GetPublicKey returns the public key of an asymmetric KMS key pair in the required DER-encoded format. If you use Amazon Web Services CLI version 1 , you must...
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 .
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 DeriveSharedSecret generate an...

Output

DeriveSharedSecretOutput.

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 —
ciphertext_for_recipient bytes | None Always present —
key_agreement_algorithm KeyAgreementAlgorithmSpecOutput | None Always present KeyAgreementAlgorithmSpecOutput
key_origin OriginTypeOutput | None Always present OriginTypeOutput

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

DeriveSharedSecretOutput, KeyAgreementAlgorithmSpec, 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.

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

Service guide · Pinned model