AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the ImportKeyMaterial operation. Imports key material into an AWS KMS customer master key (CMK) from your existing key management infrastructure. For more information about importing key material into AWS KMS, see Importing Key Material in the AWS Key Management Service Developer Guide.

You must specify the key ID of the CMK to import the key material into. This CMK's Origin must be EXTERNAL. You must also send an import token and the encrypted key material. Send the import token that you received in the same GetParametersForImport response that contained the public key that you used to encrypt the key material. You must also specify whether the key material expires and if so, when. When the key material expires, AWS KMS deletes the key material and the CMK becomes unusable. To use the CMK again, you can reimport the same key material. If you set an expiration date, you can change it only by reimporting the same key material and specifying a new expiration date.

When this operation is successful, the specified CMK's key state changes to Enabled, and you can use the CMK.

After you successfully import key material into a CMK, you can reimport the same key material into that CMK, but you cannot import different key material.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.KeyManagementService.AmazonKeyManagementServiceRequest
      Amazon.KeyManagementService.Model.ImportKeyMaterialRequest

Namespace: Amazon.KeyManagementService.Model
Assembly: AWSSDK.KeyManagementService.dll
Version: 3.x.y.z

Syntax

C#
public class ImportKeyMaterialRequest : AmazonKeyManagementServiceRequest
         IAmazonWebServiceRequest

The ImportKeyMaterialRequest type exposes the following members

Constructors

NameDescription
Public Method ImportKeyMaterialRequest()

Properties

NameTypeDescription
Public Property EncryptedKeyMaterial System.IO.MemoryStream

Gets and sets the property EncryptedKeyMaterial.

The encrypted key material to import. It must be encrypted with the public key that you received in the response to a previous GetParametersForImport request, using the wrapping algorithm that you specified in that request.

Public Property ExpirationModel Amazon.KeyManagementService.ExpirationModelType

Gets and sets the property ExpirationModel.

Specifies whether the key material expires. The default is KEY_MATERIAL_EXPIRES, in which case you must include the ValidTo parameter. When this parameter is set to KEY_MATERIAL_DOES_NOT_EXPIRE, you must omit the ValidTo parameter.

Public Property ImportToken System.IO.MemoryStream

Gets and sets the property ImportToken.

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.

Public Property KeyId System.String

Gets and sets the property KeyId.

The identifier of the CMK to import the key material into. The CMK's Origin must be EXTERNAL.

A valid identifier is the unique key ID or the Amazon Resource Name (ARN) of the CMK. Examples:

  • Unique key ID: 1234abcd-12ab-34cd-56ef-1234567890ab

  • Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab

Public Property ValidTo System.DateTime

Gets and sets the property ValidTo.

The time at which the imported key material expires. When the key material expires, AWS KMS deletes the key material and the CMK becomes unusable. You must omit this parameter when the ExpirationModel parameter is set to KEY_MATERIAL_DOES_NOT_EXPIRE. Otherwise it is required.

Examples

The following example imports key material into the specified CMK.

To import key material into a customer master key (CMK)


var response = client.ImportKeyMaterial(new ImportKeyMaterialRequest 
{
    EncryptedKeyMaterial = new MemoryStream(), // The encrypted key material to import.
    ExpirationModel = "KEY_MATERIAL_DOES_NOT_EXPIRE", // A value that specifies whether the key material expires.
    ImportToken = new MemoryStream(), // The import token that you received in the response to a previous GetParametersForImport request.
    KeyId = "1234abcd-12ab-34cd-56ef-1234567890ab" // The identifier of the CMK to import the key material into. You can use the key ID or the Amazon Resource Name (ARN) of the CMK.
});


            

Version Information

.NET Standard:
Supported in: 1.3

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms