Plaintextfield of the response object and an encrypted copy of the key in the
CiphertextBlobfield. The key is encrypted by using the master key specified by the
KeyIdfield. To decrypt the encrypted key, pass it to the
We recommend that you use the following pattern to locally encrypt data: call the
GenerateDataKey API, use the key returned in the
response field to locally encrypt data, and then erase the plaintext data key from
memory. Store the encrypted data key (contained in the
field) alongside of the locally encrypted data.
Encryptfunction to re-encrypt your data keys within a region.
GenerateDataKeyalways returns the data key encrypted and tied to the customer master key that will be used to decrypt it. There is no need to decrypt it twice.
If you decide to use the optional
EncryptionContext parameter, you must
also store the context in full or at least store enough information along with the
encrypted data to be able to reconstruct the context when submitting the ciphertext
Decrypt API. It is a good practice to choose a context that you
can reconstruct on the fly to better secure the ciphertext. For more information about
how this parameter is used, see Encryption
To decrypt data, pass the encrypted data key to the
uses the associated master key to decrypt the encrypted data key and returns it as
plaintext. Use the plaintext data key to locally decrypt your data and then erase
the key from memory. You must specify the encryption context, if any, that you specified
when you generated the key. The encryption context is logged by CloudTrail, and you
can use this log to help track the use of particular data.
Version: (assembly version)
public class GenerateDataKeyRequest : AmazonKeyManagementServiceRequest IRequestEvents
The GenerateDataKeyRequest type exposes the following members
Gets and sets the property EncryptionContext.
Name/value pair that contains additional data to be authenticated during the encryption and decryption processes that use the key. This value is logged by AWS CloudTrail to provide context around the data encrypted by the key.
Gets and sets the property GrantTokens.
A list of grant tokens.
For more information, go to Grant Tokens in the AWS Key Management Service Developer Guide.
Gets and sets the property KeyId.
A unique identifier for the customer master key. This value can be a globally unique identifier, a fully specified ARN to either an alias or a key, or an alias name prefixed by "alias/".
Gets and sets the property KeySpec.
Value that identifies the encryption algorithm and key size to generate a data key for. Currently this can be AES_128 or AES_256.
Gets and sets the property NumberOfBytes.
Integer that contains the number of bytes to generate. Common values are 128, 256,
512, and 1024. 1024 is the current limit. We recommend that you use the
Supported in: 4.5, 4.0, 3.5
.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8
.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8