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.

GetParametersForImportRequest

Class

Search:

Container for the parameters to the GetParametersForImport operation.
Returns the items you need in order to import key material into AWS KMS 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 customer master key (CMK) into which you will import
key material. This CMK's Origin must be EXTERNAL. You must
also specify the wrapping algorithm and type of wrapping key (public key) that you
will use to encrypt the key material. You cannot perform this operation on a CMK in
a different AWS account.

This operation returns a public key and an import token. Use the public key to encrypt
the key material. Store the import token to send with a subsequent ImportKeyMaterial
request. The public key and import token from the same response must be used together.
These items are valid for 24 hours. When they expire, they cannot be used for a subsequent
ImportKeyMaterial request. To get new ones, send another GetParametersForImport
request.

The type of wrapping key (public key) to return in the response. Only 2048-bit RSA
public keys are supported.

Examples

The following example retrieves the public key and import token for the specified CMK.

To retrieve the public key and import token for a customer master key (CMK)

var response = client.GetParametersForImport(new GetParametersForImportRequest
{
KeyId = "1234abcd-12ab-34cd-56ef-1234567890ab", // The identifier of the CMK for which to retrieve the public key and import token. You can use the key ID or the Amazon Resource Name (ARN) of the CMK.
WrappingAlgorithm = "RSAES_OAEP_SHA_1", // The algorithm that you will use to encrypt the key material before importing it.
WrappingKeySpec = "RSA_2048" // The type of wrapping key (public key) to return in the response.
});
MemoryStream importToken = response.ImportToken; // The import token to send with a subsequent ImportKeyMaterial request.
string keyId = response.KeyId; // The ARN of the CMK for which you are retrieving the public key and import token. This is the same CMK specified in the request.
DateTime parametersValidTo = response.ParametersValidTo; // The time at which the import token and public key are no longer valid.
MemoryStream publicKey = response.PublicKey; // The public key to use to encrypt the key material before importing it.