Skip to content

Commit

Permalink
correct array offset for ByteBuffer
Browse files Browse the repository at this point in the history
Summary:

Test Plan:
  • Loading branch information
imdominicreed committed Nov 6, 2024
1 parent 3325114 commit 2297464
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sdk/src/main/java/io/opentdf/platform/sdk/NanoTDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public int createNanoTDF(ByteBuffer data, OutputStream outputStream,
System.arraycopy(iv, 0, actualIV, kIvPadding, iv.length);
} while (Arrays.equals(actualIV, kEmptyIV)); // if match, we need to retry to prevent key + iv reuse with the policy

byte[] cipherData = gcm.encrypt(actualIV, authTagSize, data.array(), 0, dataSize);
byte[] cipherData = gcm.encrypt(actualIV, authTagSize, data.array(), data.arrayOffset(), dataSize);

// Write the length of the payload as int24
int cipherDataLengthWithoutPadding = cipherData.length - kIvPadding;
Expand Down

0 comments on commit 2297464

Please sign in to comment.