From 8d755371f28b2212fb1446121019bd43267fc139 Mon Sep 17 00:00:00 2001 From: Xiao Chen Date: Mon, 2 Apr 2018 23:07:29 -0700 Subject: [PATCH] HADOOP-15355. TestCommonConfigurationFields is broken by HADOOP-15312. Contributed by LiXin Ge. (cherry picked from commit f614b44fe583033947cc78d8f04cfe6fb64fc892) --- .../apache/hadoop/crypto/key/KeyProvider.java | 11 ++++++---- .../fs/CommonConfigurationKeysPublic.java | 21 +++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java index 62cc3818eb1..5d670e58810 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java @@ -38,6 +38,7 @@ import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import javax.crypto.KeyGenerator; @@ -53,11 +54,13 @@ import javax.crypto.KeyGenerator; @InterfaceStability.Unstable public abstract class KeyProvider { public static final String DEFAULT_CIPHER_NAME = - "hadoop.security.key.default.cipher"; - public static final String DEFAULT_CIPHER = "AES/CTR/NoPadding"; + CommonConfigurationKeysPublic.HADOOP_SECURITY_KEY_DEFAULT_CIPHER_KEY; + public static final String DEFAULT_CIPHER = + CommonConfigurationKeysPublic.HADOOP_SECURITY_KEY_DEFAULT_CIPHER_DEFAULT; public static final String DEFAULT_BITLENGTH_NAME = - "hadoop.security.key.default.bitlength"; - public static final int DEFAULT_BITLENGTH = 128; + CommonConfigurationKeysPublic.HADOOP_SECURITY_KEY_DEFAULT_BITLENGTH_KEY; + public static final int DEFAULT_BITLENGTH = CommonConfigurationKeysPublic. + HADOOP_SECURITY_KEY_DEFAULT_BITLENGTH_DEFAULT; private final Configuration conf; diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java index bbc892ce228..8cd753ab064 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java @@ -678,6 +678,27 @@ public class CommonConfigurationKeysPublic { public static final String HADOOP_SECURITY_KEY_PROVIDER_PATH = "hadoop.security.key.provider.path"; + /** + * @see + * + * core-default.xml + */ + public static final String HADOOP_SECURITY_KEY_DEFAULT_BITLENGTH_KEY = + "hadoop.security.key.default.bitlength"; + /** Defalt value for HADOOP_SECURITY_KEY_DEFAULT_BITLENGTH_KEY. */ + public static final int HADOOP_SECURITY_KEY_DEFAULT_BITLENGTH_DEFAULT = 128; + + /** + * @see + * + * core-default.xml + */ + public static final String HADOOP_SECURITY_KEY_DEFAULT_CIPHER_KEY = + "hadoop.security.key.default.cipher"; + /** Defalt value for HADOOP_SECURITY_KEY_DEFAULT_CIPHER_KEY. */ + public static final String HADOOP_SECURITY_KEY_DEFAULT_CIPHER_DEFAULT = + "AES/CTR/NoPadding"; + // /** * @see