Skip to main content

ImportKeyMaterial

Imports key material into a KMS key.

Description

The ImportKeyMaterial operation imports key material into a KMS key. This operation completes the process of importing key material into QKMS. Before calling this operation, you must first call GetParametersForImport to get the public key and import token.

note
  • The KMS key must be in a compatible key state and have no key material.
  • The key material must be encrypted with the public key from a GetParametersForImport response.
  • The import token must be from the same GetParametersForImport response.
  • The public key, import token, and encrypted key material must be from the same GetParametersForImport response.
  • For more information about importing key material, see Importing Key Material.

Request Syntax

Headers

NameDescriptionRequiredType
Content-TypeMust be "application/x-amz-json-1.1"Yesstring
X-Amz-TargetMust be "TrentService.ImportKeyMaterial"Yesstring

Request Body

NameDescriptionRequiredType
EncryptedKeyMaterialThe encrypted key material to import. The key material must be encrypted with the public key from the same GetParametersForImport response.Yesblob
ExpirationModelSpecifies whether the key material expires.

Valid Values: KEY_MATERIAL_EXPIRES | KEY_MATERIAL_DOES_NOT_EXPIRE.
Yesstring
ImportTokenThe import token that you received in the response to a previous GetParametersForImport request.Yesblob
KeyIdThe identifier of the KMS key to import the key material into. This must identify a symmetric encryption KMS key with no key material.Yesstring
ValidToThe time at which the imported key material expires. Required when ExpirationModel is KEY_MATERIAL_EXPIRES.Notimestamp
POST / HTTP/1.1
Content-Type: application/x-amz-json-1.1
X-Amz-Target: TrentService.ImportKeyMaterial
{ "EncryptedKeyMaterial": "AQICAHiBzWrXqca+q2GRHuHjYWJP+Xz9sXBxqt/9pB1lXKg4HQGZ4gXL/8Aw/zrIQEUHAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQM6v4DhjrVUqgdqVEuAgEQgDsgli8KqqW4qp0g9ZWnHdRGYc3ZJzpV3xH9qVGFRwzVVKJNK/Ey/fGS2tl4TOQXLcTYJMEOxR8gPjA=", "ExpirationModel": "KEY_MATERIAL_EXPIRES", "ImportToken": "AQICAHiBzWrXqca+q2GRHuHjYWJP+Xz9sXBxqt/9pB1lXKg4HQGZ4gXL/8Aw/zrIQEUHAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQM6v4DhjrVUqgdqVEuAgEQgDsgli8KqqW4qp0g9ZWnHdRGYc3ZJzpV3xH9qVGFRwzVVKJNK/Ey/fGS2tl4TOQXLcTYJMEOxR8gPjA=", "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "ValidTo": 1668815672 }
Values in italics indicate user input and should be replaced with actual values.

Response Elements

This operation returns no response data.

Special Errors

Error CodeDescription
DependencyTimeoutExceptionThe system timed out while trying to fulfill the request.
ExpiredImportTokenExceptionThe request was rejected because the provided import token has expired.
IncorrectKeyMaterialExceptionThe request was rejected because the provided key material is invalid or incompatible with the KMS key.
InvalidArnExceptionThe request was rejected because a specified ARN was not valid.
InvalidCiphertextExceptionThe request was rejected because the specified ciphertext has been corrupted or is otherwise invalid.
InvalidImportTokenExceptionThe request was rejected because the provided import token is invalid or is not associated with the specified KMS key.
KMSInternalExceptionAn internal error occurred.
KMSInvalidStateExceptionThe request was rejected because the key state is not valid for this operation.
NotFoundExceptionThe request was rejected because the specified entity or resource could not be found.

Permissions

To use the ImportKeyMaterial operation, you must have the following permissions:

  • kms:ImportKeyMaterial on the KMS key (specified in the policy)

Try It Out

Test ImportKeyMaterial

Import key material into a KMS key.

Coming Soon

This feature is currently under development and will be available soon.