Samrat002 commented on code in PR #28070:
URL: https://github.com/apache/flink/pull/28070#discussion_r3182677431
##########
flink-filesystems/flink-s3-fs-native/src/main/java/org/apache/flink/fs/s3native/S3EncryptionConfig.java:
##########
@@ -220,6 +200,28 @@ public ServerSideEncryption getServerSideEncryption() {
}
}
+ public String serializeEncryptionContext() {
+ StringBuilder json = new StringBuilder("{");
+ boolean first = true;
+ for (Map.Entry<String, String> entry : encryptionContext.entrySet()) {
+ if (!first) {
+ json.append(",");
+ }
+ json.append("\"")
+ .append(escapeJson(entry.getKey()))
+ .append("\":\"")
+ .append(escapeJson(entry.getValue()))
+ .append("\"");
+ first = false;
+ }
+ json.append("}");
+ return Base64.getEncoder().encodeToString(json.toString().getBytes());
Review Comment:
`getBytes()` without a charset uses the JVM default encoding, which may not
be UTF-8 on all platforms.
AWS KMS requires the context to be a valid UTF-8 JSON string.
use something like
```
json.toString().getBytes(StandardCharsets.UTF_8)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]