tom-s-powell commented on code in PR #14751:
URL: https://github.com/apache/iceberg/pull/14751#discussion_r2698330768
##########
aws/src/integration/java/org/apache/iceberg/aws/TestKeyManagementClient.java:
##########
@@ -91,13 +96,48 @@ public void testKeyWrapping() {
try (AwsKeyManagementClient keyManagementClient = new
AwsKeyManagementClient()) {
keyManagementClient.initialize(ImmutableMap.of());
- ByteBuffer key = ByteBuffer.wrap(new
String("super-secret-table-master-key").getBytes());
+ ByteBuffer key =
ByteBuffer.wrap("super-secret-table-master-key".getBytes());
ByteBuffer encryptedKey = keyManagementClient.wrapKey(key, keyId);
assertThat(keyManagementClient.unwrapKey(encryptedKey,
keyId)).isEqualTo(key);
}
}
+ @Test
+ public void testSerialization() throws Exception {
+ try (AwsKeyManagementClient keyManagementClient = new
AwsKeyManagementClient()) {
+ keyManagementClient.initialize(
+ ImmutableMap.of(
+ AwsProperties.KMS_ENCRYPTION_ALGORITHM_SPEC,
+ EncryptionAlgorithmSpec.RSAES_OAEP_SHA_256.toString(),
+ AwsProperties.KMS_DATA_KEY_SPEC,
+ DataKeySpec.AES_128.toString()));
+ assertThat(keyManagementClient.encryptionAlgorithmSpec())
+ .isEqualTo(EncryptionAlgorithmSpec.RSAES_OAEP_SHA_256);
+
assertThat(keyManagementClient.dataKeySpec()).isEqualTo(DataKeySpec.AES_128);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ try (ObjectOutputStream writer = new ObjectOutputStream(out)) {
+ writer.writeObject(keyManagementClient);
+ }
+
+ AwsKeyManagementClient result;
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+ try (ObjectInputStream reader = new ObjectInputStream(in)) {
+ result = (AwsKeyManagementClient) reader.readObject();
+ }
Review Comment:
Thanks, caught an issue. Updated all tests to use this.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]