Skip to content

Commit 952bf2b

Browse files
authored
feat: Support of other keyring types (#2799)
Signed-off-by: Pavel Jareš <pavel.jares@broadcom.com>
1 parent af38dab commit 952bf2b

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

api-catalog-ui/frontend/src/components/Wizard/configs/wizard_base_categories.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ export const baseCategories = [
285285
keyStoreType: {
286286
value: 'PKCS12',
287287
question: 'Type of the keystore:',
288-
options: ['PKCS12', 'JKS', 'JCERACFKS'],
288+
options: ['PKCS12', 'JKS', 'JCEKS', 'JCECCAKS', 'JCERACFKS', 'JCECCARACFKS', 'JCEHYBRIDRACFKS'],
289289
},
290290
trustStore: {
291291
value: '',
@@ -301,7 +301,7 @@ export const baseCategories = [
301301
trustStoreType: {
302302
value: 'PKCS12',
303303
question: 'Truststore type:',
304-
options: ['PKCS12', 'JKS', 'JCERACFKS'],
304+
options: ['PKCS12', 'JKS', 'JCEKS', 'JCECCAKS', 'JCERACFKS', 'JCECCARACFKS', 'JCEHYBRIDRACFKS'],
305305
},
306306
},
307307
},

certificate-analyser/src/test/java/org/zowe/apiml/StoresTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
import org.junit.jupiter.api.Test;
1515
import picocli.CommandLine;
1616

17-
import static org.junit.jupiter.api.Assertions.assertEquals;
18-
import static org.junit.jupiter.api.Assertions.assertThrows;
17+
import static org.junit.jupiter.api.Assertions.*;
1918

2019
class StoresTest {
2120

@@ -45,8 +44,9 @@ void whenExecuteCommand_thenStoresNotInitializeExceptionIsThrown() {
4544
ApimlConf conf = new ApimlConf();
4645
new CommandLine(conf).parseArgs(args);
4746
StoresNotInitializeException e = assertThrows(StoresNotInitializeException.class, () -> new Stores(conf));
48-
assertEquals("Error while loading keystore file. Error message: ../wrongPath/localhost.truststore.p12 (No such file or directory)\n" +
49-
"Possible solution: Verify correct path to the keystore. Change owner or permission to the keystore file.",e.getMessage());
47+
String message = e.getMessage().replace("\\wrongPath\\", "/wrongPath/"); // replace to fix issue on windows
48+
assertTrue(message.contains("Error while loading keystore file. Error message: ../wrongPath/localhost.truststore.p12"));
49+
assertTrue(message.contains("Possible solution: Verify correct path to the keystore. Change owner or permission to the keystore file."));
5050
}
5151
}
5252

onboarding-enabler-java/src/main/java/org/zowe/apiml/eurekaservice/client/util/EurekaInstanceConfigValidator.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public class EurekaInstanceConfigValidator {
2828

2929
private static final String UNSET_VALUE_STRING = "{apiml.";
3030
private static final char[] UNSET_VALUE_CHAR_ARRAY = UNSET_VALUE_STRING.toCharArray();
31-
private static final String KEYRING_KEY = "JCERACFKS";
3231

3332
private final List<String> missingSslParameters = new ArrayList<>();
3433
private final List<String> missingRoutesParameters = new ArrayList<>();
@@ -100,18 +99,24 @@ private void validateSslParameters(Ssl ssl, List<String> missingSslParameters) {
10099
}
101100
}
102101

102+
private boolean isKeyring(String in) {
103+
if (in == null) return false;
104+
if (!in.startsWith("JCE")) return false;
105+
return in.endsWith("KS");
106+
}
107+
103108
private void validateSsl(Ssl ssl) {
104109
validateSslParameters(ssl, missingSslParameters);
105110
if (isInvalid(ssl.getTrustStorePassword()) && (isInvalid(ssl.getTrustStoreType()) ||
106-
(!isInvalid(ssl.getTrustStoreType()) && !ssl.getTrustStoreType().equals(KEYRING_KEY)))) {
111+
(!isInvalid(ssl.getTrustStoreType()) && !isKeyring(ssl.getTrustStoreType())))) {
107112
addParameterToProblemsList("trustStorePassword", missingSslParameters);
108113
}
109114
if (isInvalid(ssl.getKeyStorePassword()) && (isInvalid(ssl.getKeyStoreType()) ||
110-
(!isInvalid(ssl.getKeyStoreType()) && !ssl.getKeyStoreType().equals(KEYRING_KEY)))) {
115+
(!isInvalid(ssl.getKeyStoreType()) && !isKeyring(ssl.getKeyStoreType())))) {
111116
addParameterToProblemsList("keyStorePassword", missingSslParameters);
112117
}
113118
if (isInvalid(ssl.getKeyPassword()) && (isInvalid(ssl.getKeyStoreType()) ||
114-
(!isInvalid(ssl.getKeyStoreType()) && !ssl.getKeyStoreType().equals(KEYRING_KEY)))) {
119+
(!isInvalid(ssl.getKeyStoreType()) && !isKeyring(ssl.getKeyStoreType())))) {
115120
addParameterToProblemsList("keyPassword", missingSslParameters);
116121
}
117122

0 commit comments

Comments
 (0)