Created
March 3, 2022 19:10
-
-
Save awswithdotnet/2777605c99cccdb2bae680a75b96d29d to your computer and use it in GitHub Desktop.
kms Crypto AESEncrypter Partial 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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