rdblue commented on code in PR #2639:
URL: https://github.com/apache/iceberg/pull/2639#discussion_r1103902424
##########
parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java:
##########
@@ -231,6 +243,31 @@ private WriteBuilder createContextFunc(
return this;
}
+ private FileEncryptionProperties
createEncryptionProperties(EncryptionKeyMetadata keyMetadata) {
+ Preconditions.checkArgument(keyMetadata != null, "Null key metadata");
+
+ // Native Parquet encryption can be activated only by envelope metadata.
+ // Other metadata types imply flat/generic file encryption
+ if (!(keyMetadata instanceof EnvelopeKeyMetadata)) {
+ return null;
+ }
+
+ EnvelopeKeyMetadata envelopeMetadata = (EnvelopeKeyMetadata) keyMetadata;
+
+ ByteBuffer footerDataKey = envelopeMetadata.encryptionKey();
+ if (null == footerDataKey) {
+ throw new ParquetCryptoRuntimeException(
+ "Can't create parquet encryption properties - missing key for
parquet footer");
+ }
+
+ ByteBuffer aadPrefixBB = envelopeMetadata.aadPrefix();
+ byte[] aadPrefix = (null == aadPrefixBB) ? null : aadPrefixBB.array();
+
+ return FileEncryptionProperties.builder(footerDataKey.array())
Review Comment:
Same here. Should be `ByteBuffers.toByteArray`
--
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]