We're in the process of implementing the encryption spec in rust and python and have noticed something in the spec wording https://github.com/apache/iceberg/blob/1504ddd5d5119e934e7cbcaed82b9384caf35b82/format/gcm-stream-spec.md#cipher-block-structure The last block has a non-zero length <= BlockLength but Java AesGcmOutputStream will actually write an empty block and AesGcmInputFile will reject anything shorter than MIN_STREAM_LENGTH
|
public SeekableInputStream newStream() { |
|
long ciphertextLength = encryptedLength(); |
|
Preconditions.checkState( |
|
ciphertextLength >= Ciphers.MIN_STREAM_LENGTH, |
|
"Invalid encrypted stream: %s is shorter than the minimum possible stream length", |
|
ciphertextLength); |
|
return new AesGcmInputStream(sourceFile.newStream(), ciphertextLength, dataKey, fileAADPrefix); |
So java seems to disagree in both directions?
Link to python PR where this discussion came up apache/iceberg-python#3969
We're in the process of implementing the encryption spec in rust and python and have noticed something in the spec wording https://github.com/apache/iceberg/blob/1504ddd5d5119e934e7cbcaed82b9384caf35b82/format/gcm-stream-spec.md#cipher-block-structure
The last block has a non-zero length <= BlockLengthbut JavaAesGcmOutputStreamwill actually write an empty block andAesGcmInputFilewill reject anything shorter thanMIN_STREAM_LENGTHiceberg/core/src/main/java/org/apache/iceberg/encryption/AesGcmInputFile.java
Lines 68 to 74 in 1504ddd
So java seems to disagree in both directions?
Link to python PR where this discussion came up apache/iceberg-python#3969