Skip to content

Commit 70138c4

Browse files
authored
RANGER-5435: Change the default KMS ZoneKey length from 128 to 256 (#902)
1 parent f180bee commit 70138c4

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

  • kms/src/main/java/org/apache/hadoop/crypto/key/kms/server
  • security-admin/src/main

kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMS.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public class KMS {
8080
private static final String KEY_NAME_VALIDATION = "[a-z,A-Z,0-9](?!.*--)(?!.*__)(?!.*-_)(?!.*_-)[\\w\\-\\_]*";
8181
private static final int MAX_NUM_PER_BATCH = 10000;
8282
private static final String GENERATE_DEK_PATH_CONST = "_dek";
83+
private static final int DEFAULT_KEY_SIZE = 256;
8384

8485
private final KeyProviderCryptoExtension provider;
8586
private final KMSAudit kmsAudit;
@@ -113,7 +114,7 @@ public Response createKey(Map jsonKey, @Context HttpServletRequest request) thro
113114

114115
final String cipher = (String) jsonKey.get(KMSRESTConstants.CIPHER_FIELD);
115116
final String material = (String) jsonKey.get(KMSRESTConstants.MATERIAL_FIELD);
116-
final int length = (jsonKey.containsKey(KMSRESTConstants.LENGTH_FIELD)) ? (Integer) jsonKey.get(KMSRESTConstants.LENGTH_FIELD) : 0;
117+
final int length = (jsonKey.containsKey(KMSRESTConstants.LENGTH_FIELD)) ? (Integer) jsonKey.get(KMSRESTConstants.LENGTH_FIELD) : DEFAULT_KEY_SIZE;
117118
final String description = (String) jsonKey.get(KMSRESTConstants.DESCRIPTION_FIELD);
118119

119120
LOG.debug("Creating key: name={}, cipher={}, keyLength={}, description={}", name, cipher, length, description);

security-admin/src/main/java/org/apache/ranger/view/VXKmsKey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class VXKmsKey extends VXDataObject implements java.io.Serializable {
4848
/**
4949
* Length
5050
*/
51-
protected int length;
51+
protected int length = 256;
5252
/**
5353
* Description
5454
*/

security-admin/src/main/webapp/react-webapp/src/views/Encryption/KeyCreate.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ function KeyCreate(props) {
242242
initialValues={{
243243
attributes: [{ name: "", value: "" }],
244244
cipher: "AES/CTR/NoPadding",
245-
length: "128"
245+
length: "256"
246246
}}
247247
render={({
248248
handleSubmit,

0 commit comments

Comments
 (0)