Skip to content

Instantly share code, notes, and snippets.

@awswithdotnet
Created March 3, 2022 19:10
Show Gist options
  • Save awswithdotnet/2777605c99cccdb2bae680a75b96d29d to your computer and use it in GitHub Desktop.
Save awswithdotnet/2777605c99cccdb2bae680a75b96d29d to your computer and use it in GitHub Desktop.
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