ggershinsky commented on a change in pull request #3053:
URL: https://github.com/apache/iceberg/pull/3053#discussion_r722171507



##########
File path: 
core/src/main/java/org/apache/iceberg/hadoop/HadoopTableOperations.java
##########
@@ -82,6 +95,104 @@ public TableMetadata current() {
     return currentMetadata;
   }
 
+  @Override
+  @SuppressWarnings("checkstyle:CyclomaticComplexity")
+  public EncryptionManager encryption() {
+    // TODO run by single thread? or synchronize?
+    if (null != encryptionManager) {
+      return encryptionManager;
+    }
+
+    TableMetadata tableMetadata = current();
+    Map<String, String> tableProperties = tableMetadata.properties();
+
+    String keyManagerType = PropertyUtil.propertyAsString(tableProperties,
+            TableProperties.ENCRYPTION_MANAGER_TYPE, 
TableProperties.ENCRYPTION_MANAGER_TYPE_PLAINTEXT);
+    if 
(keyManagerType.equals(TableProperties.ENCRYPTION_MANAGER_TYPE_PLAINTEXT)) {
+      encryptionManager = new PlaintextEncryptionManager();
+      return encryptionManager;
+    }
+
+    if 
(keyManagerType.equals(TableProperties.ENCRYPTION_MANAGER_TYPE_SINGLE_ENVELOPE) 
||
+            
keyManagerType.equals(TableProperties.ENCRYPTION_MANAGER_TYPE_DOUBLE_ENVELOPE)) 
{
+      boolean doubleWrap = 
keyManagerType.equals(TableProperties.ENCRYPTION_MANAGER_TYPE_DOUBLE_ENVELOPE);
+      if (doubleWrap) {
+        throw new RuntimeException("Double envelope encryption is not 
supported yet");
+      }

Review comment:
       agreed




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