AWS(AwsCrypto) encryption result vary every time

222 Views Asked by At

The returned string vary every when I execute below code. Is there something I can config so that return fixed result?

final AwsCrypto crypto = new AwsCrypto();
new String(Base64.getEncoder().encode(crypto.encryptData(masterKeyProvider, EXAMPLE_DATA).getResult()))
1

There are 1 best solutions below

0
On BEST ANSWER

In the SDK, AWS have add some signature which is random and can not be removed, so the encrypted string is not constant. https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/algorithms-reference.html