Amazon.KeyManagementService.AmazonKeyManagementServiceClient.ImportKeyMaterial C# (CSharp) Method

ImportKeyMaterial() public method

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.

/// The system timed out while trying to fulfill the request. The request can be retried. /// /// The request was rejected because the provided import token is expired. Use GetParametersForImport /// to retrieve a new import token and public key, use the new public key to encrypt the /// key material, and then try the request again. /// /// The request was rejected because the provided key material is invalid or is not the /// same key material that was previously imported into this customer master key (CMK). /// /// The request was rejected because a specified ARN was not valid. /// /// The request was rejected because the specified ciphertext has been corrupted or is /// otherwise invalid. /// /// The request was rejected because the provided import token is invalid or is associated /// with a different customer master key (CMK). /// /// The request was rejected because an internal exception occurred. The request can be /// retried. /// /// The request was rejected because the state of the specified resource is not valid /// for this request. /// /// /// /// For more information about how key state affects the use of a CMK, see How /// Key State Affects Use of a Customer Master Key in the AWS Key Management Service /// Developer Guide. /// /// /// The request was rejected because the specified entity or resource could not be found. /// /// The request was rejected because a specified parameter is not supported or a specified /// resource is not valid for this operation. ///
public ImportKeyMaterial ( ImportKeyMaterialRequest request ) : ImportKeyMaterialResponse
request ImportKeyMaterialRequest Container for the necessary parameters to execute the ImportKeyMaterial service method.
return ImportKeyMaterialResponse
        public ImportKeyMaterialResponse ImportKeyMaterial(ImportKeyMaterialRequest request)
        {
            var marshaller = new ImportKeyMaterialRequestMarshaller();
            var unmarshaller = ImportKeyMaterialResponseUnmarshaller.Instance;

            return Invoke<ImportKeyMaterialRequest,ImportKeyMaterialResponse>(request, marshaller, unmarshaller);
        }
AmazonKeyManagementServiceClient