ggershinsky commented on code in PR #3231:
URL: https://github.com/apache/iceberg/pull/3231#discussion_r1281477366


##########
core/src/main/java/org/apache/iceberg/encryption/Ciphers.java:
##########
@@ -55,10 +71,15 @@ public AesGcmEncryptor(byte[] keyBytes) {
       this.randomGenerator = new SecureRandom();
     }
 
-    public byte[] encrypt(byte[] plainText, byte[] aad) {
+    public byte[] encrypt(byte[] plaintext, byte[] aad) {
+      return encrypt(plaintext, 0, plaintext.length, aad);
+    }
+
+    public byte[] encrypt(byte[] plaintext, int plaintextOffset, int 
plaintextLength, byte[] aad) {
+      Preconditions.checkArgument(plaintextLength > 0, "Wrong plaintextLength 
" + plaintextLength);
       byte[] nonce = new byte[NONCE_LENGTH];
       randomGenerator.nextBytes(nonce);
-      int cipherTextLength = NONCE_LENGTH + plainText.length + GCM_TAG_LENGTH;
+      int cipherTextLength = NONCE_LENGTH + plaintextLength + GCM_TAG_LENGTH;

Review Comment:
   Done for simplicity, since manifest encryption won't benefit much from this 
optimization. 
   But we can add now, for Avro data encryption in the future.
   Btw, the same optimization can be performed for decryption.



-- 
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]

Reply via email to