You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/01/19 19:42:31 UTC

[GitHub] [iceberg] flyrain commented on a change in pull request #2638: Core: Encryption basics

flyrain commented on a change in pull request #2638:
URL: https://github.com/apache/iceberg/pull/2638#discussion_r788081044



##########
File path: api/src/main/java/org/apache/iceberg/encryption/NativeFileCryptoParameters.java
##########
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.iceberg.encryption;
+
+import java.nio.ByteBuffer;
+import java.util.Map;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+
+/**
+ * Barebone encryption parameters, one object per content file.
+ * Carries the file encryption key (and optional AAD prefix, column keys).
+ */
+public class NativeFileCryptoParameters {
+  private ByteBuffer fileAadPrefix;
+  private Map<String, ByteBuffer> columnKeys;
+  private ByteBuffer fileKey;
+  private String fileEncryptionAlgorithm;
+
+  private NativeFileCryptoParameters(Map<String, ByteBuffer> columnKeys, ByteBuffer fileKey,
+                                     ByteBuffer fileAadPrefix, String fileEncryptionAlgorithm) {
+    Preconditions.checkState((columnKeys != null && columnKeys.size() > 0) || fileKey != null,
+            "No file or column keys are supplied");
+    this.columnKeys = columnKeys;
+    this.fileKey = fileKey;
+    this.fileAadPrefix = fileAadPrefix;
+    this.fileEncryptionAlgorithm = fileEncryptionAlgorithm;
+  }
+
+  /**
+   * Creates the builder.

Review comment:
       Nit: we normally have an empty line between line 48 and 49.




-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org