| | |
| | | argList.add("--adminConnectorPort"); |
| | | argList.add(String.valueOf(getUserData().getAdminConnectorPort())); |
| | | |
| | | SecurityOptions sec = getUserData().getSecurityOptions(); |
| | | final SecurityOptions sec = getUserData().getSecurityOptions(); |
| | | configureCertificate(sec); |
| | | // TODO: even if the user does not configure SSL maybe we should choose |
| | | // a secure port that is not being used and that we can actually use. |
| | | if (sec.getEnableSSL()) |
| | |
| | | invokeLongOperation(thread); |
| | | notifyListeners(getFormattedDoneWithLineBreak()); |
| | | checkAbort(); |
| | | configureCertificate(sec); |
| | | } |
| | | |
| | | private void configureCertificate(SecurityOptions sec) throws ApplicationException |
| | |
| | | String pwd = getSelfSignedCertificatePwd(); |
| | | final CertificateManager certManager = |
| | | new CertificateManager(getSelfSignedKeystorePath(), CertificateManager.KEY_STORE_TYPE_JKS, pwd); |
| | | for (String alias : SELF_SIGNED_CERT_ALIASES) |
| | | for (String alias : sec.getAliasesToUse()) |
| | | { |
| | | final KeyType keyType = KeyType.getTypeOrDefault(alias); |
| | | certManager.generateSelfSignedCertificate(keyType, alias, getSelfSignedCertificateSubjectDN(keyType), |
| | |
| | | final String trustStoreType, final SecurityOptions sec) throws Exception |
| | | { |
| | | final String keystorePassword = sec.getKeystorePassword(); |
| | | final String keyStoreAlias = sec.getAliasToUse(); |
| | | |
| | | CertificateManager certManager = new CertificateManager(keyStorePath, keyStoreType, keystorePassword); |
| | | SetupUtils.exportCertificate(certManager, keyStoreAlias, getTemporaryCertificatePath()); |
| | | configureTrustStore(trustStoreType, keyStoreAlias, keystorePassword); |
| | | for (String keyStoreAlias : sec.getAliasesToUse()) |
| | | { |
| | | SetupUtils.exportCertificate(certManager, keyStoreAlias, getTemporaryCertificatePath()); |
| | | configureTrustStore(trustStoreType, keyStoreAlias, keystorePassword); |
| | | } |
| | | } |
| | | |
| | | private void configureTrustStore(final String type, final String keyStoreAlias, final String password) |
| | |
| | | |
| | | private void addCertificateArguments(SecurityOptions sec, List<String> argList) |
| | | { |
| | | final String aliasInKeyStore = sec.getAliasToUse(); |
| | | final Collection<String> aliasInKeyStore = sec.getAliasesToUse(); |
| | | |
| | | switch (sec.getCertificateType()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private void addCertificateArguments(List<String> argList, SecurityOptions sec, String aliasInKeyStore, |
| | | String keyStoreDN, String trustStoreDN) |
| | | private static void addCertificateArguments(List<String> argList, SecurityOptions sec, |
| | | Collection<String> aliasesInKeyStore, String keyStoreDN, String trustStoreDN) |
| | | { |
| | | argList.add("-k"); |
| | | argList.add(keyStoreDN); |
| | |
| | | argList.add("-m"); |
| | | argList.add(sec.getKeystorePath()); |
| | | } |
| | | if (aliasInKeyStore != null) |
| | | for(String alias : aliasesInKeyStore) |
| | | { |
| | | argList.add("-a"); |
| | | argList.add(aliasInKeyStore); |
| | | argList.add(alias); |
| | | } |
| | | } |
| | | |