Skip to content

Commit 77ae13c

Browse files
committed
Hex encode associated data when populating AWS EncryptionContext.
PiperOrigin-RevId: 536515641 Change-Id: I9aec1e01f68adc268015291ee046b48c34b3972f (cherry picked from commit 1cbabf5)
1 parent fdd95cb commit 77ae13c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tink/integration/awskms/aws_kms_aead.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ util::StatusOr<std::string> AwsKmsAead::Encrypt(
7272
req.SetPlaintext(plaintext_buffer);
7373
if (!associated_data.empty()) {
7474
req.AddEncryptionContext("associatedData",
75-
absl::HexStringToBytes(associated_data).c_str());
75+
absl::BytesToHexString(associated_data).c_str());
7676
}
7777
auto outcome = aws_client_->Encrypt(req);
7878
if (!outcome.IsSuccess()) {
@@ -98,7 +98,7 @@ util::StatusOr<std::string> AwsKmsAead::Decrypt(
9898
req.SetCiphertextBlob(ciphertext_buffer);
9999
if (!associated_data.empty()) {
100100
req.AddEncryptionContext("associatedData",
101-
absl::HexStringToBytes(associated_data).c_str());
101+
absl::BytesToHexString(associated_data).c_str());
102102
}
103103
auto outcome = aws_client_->Decrypt(req);
104104
if (!outcome.IsSuccess()) {

0 commit comments

Comments
 (0)