Java program to encode and decode a string with key

broken image
broken image

When you call getResult on theĬryptoResult object, it returns a base-64-encoded string version of the encrypted message that you can pass to the When you call the encryptData() method, it returns an encrypted message ( CryptoResult) that includes the ciphertext, theĮncrypted data keys, and the encryption context. For information about IDs for AWS KMS keys, see Key identifiers in the AWS Key Management Service Developer Guide. The keyArn parameter is used for encrypting and decrypting, its value must be a KmsMasterKeyProvider buildStrict() method takes a key ID, key ARN, alias name, or alias ARN. This example uses an AWS KMS key as the wrapping key. Before using the string, convert it into a byte array. The following example shows you how to use the AWS Encryption SDK for Java to encrypt and decrypt

broken image