Skip to main content
This section shows how to test encryption and decryption by using the XKS key stored securely on the CryptoHub.

Install AWS CLI

Refer to the Amazon documentation ( docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) for installing AWS CLI on your local machine.

Test encryption and decryption

You can use the following Bash script to test encryption and decryption with the XKS key. The only value you must update in the script is theARN/Key ID. The last output of the script indicates whether the test passes or fails.
To use this example, you must trim the ARN string and get only the Key ID, which is bolded in the following example string:arn:aws:kms:us-east-2:993246061881:key/``d74123b9-0743-46d9-a22a-761239f139
Bash
Perform the following steps:
1
Save the preceding Bash script to a file with the .sh extension (such as EncryptDecryptTest.sh).
2
Make the script executable with thechmod command in Linux or macOS:
Shell
3
And run the script with the following command:
Shell