Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
ggershinsky committed Sep 19, 2023
1 parent 797d893 commit fbbecba
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/apache/iceberg/TableOperations.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public interface TableOperations {
* files.
*/
default EncryptionManager encryption() {
return new PlaintextEncryptionManager();
return PlaintextEncryptionManager.instance();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,6 @@ public static EncryptionKeyMetadata createKeyMetadata(ByteBuffer key, ByteBuffer
return new KeyMetadata(key, aadPrefix);
}

public static long gcmEncryptionLength(long plainFileLength) {
int numberOfFullBlocks = Math.toIntExact(plainFileLength / Ciphers.PLAIN_BLOCK_SIZE);
int plainBytesInLastBlock =
Math.toIntExact(plainFileLength - numberOfFullBlocks * Ciphers.PLAIN_BLOCK_SIZE);
boolean fullBlocksOnly = (0 == plainBytesInLastBlock);
int cipherBytesInLastBlock =
fullBlocksOnly ? 0 : plainBytesInLastBlock + Ciphers.NONCE_LENGTH + Ciphers.GCM_TAG_LENGTH;
int cipherBlockSize = Ciphers.PLAIN_BLOCK_SIZE + Ciphers.NONCE_LENGTH + Ciphers.GCM_TAG_LENGTH;
return (long) Ciphers.GCM_STREAM_HEADER_LENGTH
+ numberOfFullBlocks * cipherBlockSize
+ cipherBytesInLastBlock;
}

static KeyManagementClient createKmsClient(String kmsImpl) {
DynConstructors.Ctor<KeyManagementClient> ctor;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ private Map<String, InputFile> inputFiles() {

// decrypt with the batch call to avoid multiple RPCs to a key server, if possible
Iterable<InputFile> decryptedFiles = table.encryption().decrypt(encryptedFiles::iterator);

Map<String, InputFile> files = Maps.newHashMapWithExpectedSize(taskGroup.tasks().size());
decryptedFiles.forEach(decrypted -> files.putIfAbsent(decrypted.location(), decrypted));
this.lazyInputFiles = ImmutableMap.copyOf(files);
Expand Down

0 comments on commit fbbecba

Please sign in to comment.