Skip to content

Commit 814f5db

Browse files
nit: error message
1 parent c0f66f3 commit 814f5db

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

x-pack/plugin/security/cli/src/main/java/org/elasticsearch/xpack/security/cli/CertGenUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ public static KeyUsage buildKeyUsage(Collection<String> keyUsages) {
479479

480480
int usageBits = 0;
481481
for (String keyUsage : keyUsages) {
482-
Integer keyUsageValue = KEY_USAGE_MAPPINGS.get(keyUsage);
482+
Integer keyUsageValue = KEY_USAGE_MAPPINGS.get(keyUsage.trim());
483483
if (keyUsageValue == null) {
484484
throw new IllegalArgumentException("Unknown keyUsage: " + keyUsage);
485485
}

x-pack/plugin/security/cli/src/main/java/org/elasticsearch/xpack/security/cli/HttpCertificateCommand.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,9 +1050,10 @@ private static List<String> readKeyUsage(Terminal terminal, List<String> default
10501050
}
10511051
if (CertGenUtils.isValidKeyUsage(keyUsage) == false) {
10521052
terminal.println("Invalid key usage: " + keyUsage);
1053-
terminal.println(
1054-
"The key usage should be one of [" + CertGenUtils.KEY_USAGE_MAPPINGS.keySet().stream().sorted() + "] values"
1055-
);
1053+
terminal.println("The key usage should be one of the following values: ");
1054+
for (String keyUsageName : CertGenUtils.KEY_USAGE_MAPPINGS.keySet()) {
1055+
terminal.println(" - " + keyUsageName);
1056+
}
10561057
return null;
10571058
}
10581059
resolvedKeyUsages.add(keyUsage);

0 commit comments

Comments
 (0)