Skip to content

Instantly share code, notes, and snippets.

@awswithdotnet
Created March 3, 2022 19:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
kms Crypto AESEncrypter Partial 2
byte[] encryptedData;
AmazonKeyManagementServiceClient kmsClient = new AmazonKeyManagementServiceClient();
GenerateDataKeyRequest dataKeyRequest = new GenerateDataKeyRequest()
{
KeyId = _keyId,
KeySpec = DataKeySpec.AES_256
};
GenerateDataKeyResponse dataKeyResponse = await kmsClient.GenerateDataKeyAsync(dataKeyRequest);
byte[] encryptedDataKey = dataKeyResponse.CiphertextBlob.ToArray();
byte[] plainTextKey = dataKeyResponse.Plaintext.ToArray();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment