KMSClient.import_key_material
rboto-kms==0.4.0 · Service index · Types
Model summary (excerpt): Imports or reimports key material into an existing KMS key that was created without key material. You can also use this operation to set or update the expiration model and expiration date of the imported key material. By default, KMS creates KMS keys with key material that it generates. You can also generate and import your own key material. For more information about importing key material,...
Install and imports
from rboto import KMSClient
from rboto_kms.types import (
ExpirationModelType,
ImportKeyMaterialOutput,
ImportType,
)
Signature
async def import_key_material(
*,
key_id: str,
import_token: bytes,
encrypted_key_material: bytes,
valid_to: str | None = None,
expiration_model: ExpirationModelType | None = None,
import_type: ImportType | None = None,
key_material_description: str | None = None,
key_material_id: str | None = None,
) -> ImportKeyMaterialOutput: ...
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 | The identifier of the KMS key that will be associated with the imported key material. This must be the same KMS key specified in the KeyID parameter of the corresponding GetParametersForImport request. The Origin of the KMS key must be EXTERNAL and its KeyState must be PendingImport . The KMS key can be a symmetric encryption KMS key, HMAC KMS key, asymmetric encryption KMS key, or asymmetric... |
import_token |
Yes | The import token that you received in the response to a previous GetParametersForImport request. It must be from the same response that contained the public key that you used to encrypt the key material. |
encrypted_key_material |
Yes | The encrypted key material to import. The key material must be encrypted under the public wrapping key that GetParametersForImport returned, using the wrapping algorithm that you specified in the same GetParametersForImport request. |
valid_to |
No | The date and time when the imported key material expires. This parameter is required when the value of the ExpirationModel parameter is KEY_MATERIAL_EXPIRES . Otherwise it is not valid. The value of this parameter must be a future date and time. The maximum value is 365 days from the request date. When the key material expires, KMS deletes the key material from the KMS key. Without its key... |
expiration_model |
No | Specifies whether the key material expires. The default is KEY_MATERIAL_EXPIRES . For help with this choice, see Setting an expiration time in the Key Management Service Developer Guide . When the value of ExpirationModel is KEY_MATERIAL_EXPIRES , you must specify a value for the ValidTo parameter. When value is KEY_MATERIAL_DOES_NOT_EXPIRE , you must omit the ValidTo parameter. You cannot... |
import_type |
No | Indicates whether the key material being imported is previously associated with this KMS key or not. This parameter is optional and only usable with symmetric encryption keys. If no key material has ever been imported into the KMS key, and this parameter is omitted, the parameter defaults to NEW_KEY_MATERIAL . After the first key material is imported, if this parameter is omitted then the... |
key_material_description |
No | Description for the key material being imported. This parameter is optional and only usable with symmetric encryption keys. If you do not specify a key material description, KMS retains the value you specified when you last imported the same key material into this KMS key. |
key_material_id |
No | Identifies the key material being imported. This parameter is optional and only usable with symmetric encryption keys. You cannot specify a key material ID with ImportType set to NEW_KEY_MATERIAL . Whenever you import key material into a symmetric encryption key, KMS assigns a unique identifier to the key material based on the KMS key ID and the imported key material. When you re-import key... |
Output
ImportKeyMaterialOutput.
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 | — |
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.
Related types
ExpirationModelType, ImportKeyMaterialOutput, ImportType
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, ExpiredImportTokenError, IncorrectKeyMaterialError, InvalidArnError, InvalidCiphertextError, InvalidImportTokenError, KMSInternalError, KMSInvalidStateError, NotFoundError, UnsupportedOperationError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.