Skip to content

Commit decade1

Browse files
committed
Update by review
Change-Id: I8feab0406d46892daa954a1e41eb193f031ee77a
1 parent ea7f701 commit decade1

File tree

3 files changed

+25
-36
lines changed

3 files changed

+25
-36
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,20 +1005,13 @@ public class CommonConfigurationKeysPublic {
10051005
public static final String HADOOP_SECURITY_CREDENTIAL_PASSWORD_FILE_KEY =
10061006
"hadoop.security.credstore.java-keystore-provider.password-file";
10071007

1008-
/**
1009-
* @see
1010-
* <a href="{@docRoot}/../hadoop-project-dist/hadoop-common/core-default.xml">
1011-
* core-default.xml</a>
1012-
*/
1013-
public static final String HMAC_ALGORITHM = "hadoop.security.hmac-algorithm";
1014-
public static final String DEFAULT_HMAC_ALGORITHM = "HmacSHA1";
1008+
public static final String HADOOP_SECURITY_SECRET_MANAGER_KEY_GENERATOR_ALGORITHM_KEY =
1009+
"secret-manager.key-generator.algorith";
1010+
public static final String HADOOP_SECURITY_SECRET_MANAGER_KEY_GENERATOR_ALGORITHM_DEFAULT =
1011+
"HmacSHA1";
10151012

1016-
/**
1017-
* @see
1018-
* <a href="{@docRoot}/../hadoop-project-dist/hadoop-common/core-default.xml">
1019-
* core-default.xml</a>
1020-
*/
1021-
public static final String HMAC_LENGTH = "hadoop.security.hmac-length";
1013+
public static final String HADOOP_SECURITY_SECRET_MANAGER_KEY_LENGTH_KEY =
1014+
"hadoop.security.secret-manager.key-length";
10221015
public static final int DEFAULT_HMAC_LENGTH = 64;
10231016

10241017
/**

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/SecretManager.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ public void checkAvailableForRead() throws StandbyException {
121121
static {
122122
Configuration conf = new Configuration();
123123
String algorithm = conf.get(
124-
CommonConfigurationKeysPublic.HMAC_ALGORITHM,
125-
CommonConfigurationKeysPublic.DEFAULT_HMAC_ALGORITHM);
124+
CommonConfigurationKeysPublic.HADOOP_SECURITY_SECRET_MANAGER_KEY_GENERATOR_ALGORITHM_KEY,
125+
CommonConfigurationKeysPublic.HADOOP_SECURITY_SECRET_MANAGER_KEY_GENERATOR_ALGORITHM_DEFAULT);
126126
LOG.info("Selected hash algorithm: {}", algorithm);
127127
SELECTED_ALGORITHM = algorithm;
128128
int length = conf.getInt(
129-
CommonConfigurationKeysPublic.HMAC_LENGTH,
129+
CommonConfigurationKeysPublic.HADOOP_SECURITY_SECRET_MANAGER_KEY_LENGTH_KEY,
130130
CommonConfigurationKeysPublic.DEFAULT_HMAC_LENGTH);
131131
LOG.info("Selected hash key length:{}", length);
132132
SELECTED_LENGTH = length;
@@ -142,7 +142,7 @@ protected Mac initialValue() {
142142
try {
143143
return Mac.getInstance(SELECTED_ALGORITHM);
144144
} catch (NoSuchAlgorithmException nsa) {
145-
throw new IllegalArgumentException("Can't find " + SELECTED_ALGORITHM + " algorithm.");
145+
throw new IllegalArgumentException("Can't find " + SELECTED_ALGORITHM, nsa);
146146
}
147147
}
148148
};
@@ -156,7 +156,7 @@ protected Mac initialValue() {
156156
keyGen = KeyGenerator.getInstance(SELECTED_ALGORITHM);
157157
keyGen.init(SELECTED_LENGTH);
158158
} catch (NoSuchAlgorithmException nsa) {
159-
throw new IllegalArgumentException("Can't find " + SELECTED_ALGORITHM + " algorithm.");
159+
throw new IllegalArgumentException("Can't find " + SELECTED_ALGORITHM, nsa);
160160
}
161161
}
162162

hadoop-common-project/hadoop-common/src/main/resources/core-default.xml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,29 +1047,25 @@
10471047
</property>
10481048

10491049
<property>
1050-
<name>hadoop.security.hmac-algorithm</name>
1050+
<name>secret-manager.key-generator.algorith</name>
10511051
<value>HmacSHA1</value>
1052-
<description>The configuration key specifying the hashing algorithm used for
1053-
HMAC (Hash-based Message Authentication Code) operations.
1054-
1055-
The HMAC algorithm is used in token management to compute secure
1056-
message digests. This configuration allows users to specify the
1057-
algorithm to be used for HMAC operations. The algorithm must be a
1058-
valid cryptographic hash algorithm supported by the Java Cryptography
1059-
Architecture (JCA). Common examples include "HmacSHA1", "HmacSHA256",
1060-
and "HmacSHA512".</description>
1052+
<description>
1053+
The configuration key specifying the KeyGenerator algorithm used in SecretManager
1054+
for generating secret keys. The algorithm must be a KeyGenerator algorithm supported by
1055+
the Java Cryptography Architecture (JCA). Common examples include "HmacSHA1",
1056+
"HmacSHA256", and "HmacSHA512".
1057+
</description>
10611058
</property>
10621059

10631060
<property>
1064-
<name>hadoop.security.hmac-length</name>
1061+
<name>hadoop.security.secret-manager.key-length</name>
10651062
<value>64</value>
1066-
<description>The configuration key specifying the key length for HMAC (Hash-based
1067-
Message Authentication Code) operations.
1068-
1069-
This property determines the size of the secret keys generated
1070-
for HMAC computations. The key length must be appropriate for the
1071-
selected HMAC algorithm. For example, longer keys are generally
1072-
more secure but may not be supported by all algorithms.</description>
1063+
<description>
1064+
The configuration key specifying the key length of the generated secret keys
1065+
in SecretManager. The key length must be appropriate for the algorithm.
1066+
For example, longer keys are generally more secure but may not be supported
1067+
by all algorithms.
1068+
</description>
10731069
</property>
10741070

10751071
<!-- file system properties -->

0 commit comments

Comments
 (0)