hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (Jira)" <j...@apache.org>
Subject [jira] [Work logged] (HDDS-2014) Create Symmetric Key for GDPR
Date Thu, 29 Aug 2019 21:07:00 GMT

     [ https://issues.apache.org/jira/browse/HDDS-2014?focusedWorklogId=303917&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-303917
]

ASF GitHub Bot logged work on HDDS-2014:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Aug/19 21:06
            Start Date: 29/Aug/19 21:06
    Worklog Time Spent: 10m 
      Work Description: dineshchitlangia commented on pull request #1362: HDDS-2014. Create
Symmetric Key for GDPR
URL: https://github.com/apache/hadoop/pull/1362#discussion_r319271572
 
 

 ##########
 File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/GDPRSymmetricKey.java
 ##########
 @@ -0,0 +1,83 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.ozone.security;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * Symmetric Key structure for GDPR.
+ */
+public class GDPRSymmetricKey {
+
+  private SecretKeySpec secretKey;
+  private Cipher cipher;
+  private String algorithm;
+  private String secret;
+
+  public SecretKeySpec getSecretKey() {
+    return secretKey;
+  }
+
+  public Cipher getCipher() {
+    return cipher;
+  }
+
+  /**
+   * Default constructor creates key with default values.
+   * @throws Exception
+   */
+  public GDPRSymmetricKey() throws Exception {
+    algorithm = OzoneConsts.GDPR_ALGORITHM_NAME;
+    secret = RandomStringUtils
+        .randomAlphabetic(OzoneConsts.GDPR_RANDOM_SECRET_LENGTH);
+    this.secretKey = new SecretKeySpec(
+        secret.substring(0, OzoneConsts.GDPR_RANDOM_SECRET_LENGTH)
+            .getBytes(OzoneConsts.GDPR_CHARSET), algorithm);
+    this.cipher = Cipher.getInstance(algorithm);
+  }
+
+  /**
+   * Overloaded constructor creates key with specified values.
+   * @throws Exception
+   */
+  public GDPRSymmetricKey(String secret, String algorithm) throws Exception {
+    Preconditions.checkArgument(secret.length() == 32,
+        "Secret must be exactly 32 characters");
 
 Review comment:
   So, here the instance of Key is not created by a user. It is created purely by Ozone system
as today, user does not have to specify the key length/secret etc.
   This is just an additional check being done.
   
   This check comes into picture when user wants to read a file from GDPR Enabled bucket.
   During the read, the RPCClient will ideally fetch the Key metadata and from that will get
the secret & algorithm. That is when the RPCClient will basically construct a symmetric
key using this secret & algorithm and be able to decrypt the file for the user.
   
   This has been done basically to support the idea that in future we may want to give users
the flexibility to choose their algorithm/secret.
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 303917)
    Time Spent: 3h  (was: 2h 50m)

> Create Symmetric Key for GDPR
> -----------------------------
>
>                 Key: HDDS-2014
>                 URL: https://issues.apache.org/jira/browse/HDDS-2014
>             Project: Hadoop Distributed Data Store
>          Issue Type: Sub-task
>            Reporter: Dinesh Chitlangia
>            Assignee: Dinesh Chitlangia
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 3h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.2#803003)

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


Mime
View raw message