@Test public void testKeyStoreType() throws CommandLineParseException, IOException { String testType = "testType"; tlsCertificateAuthorityClientCommandLine.parse("-t", testToken, "-T", testType); TlsClientConfig clientConfig = tlsCertificateAuthorityClientCommandLine.createClientConfig(); assertEquals(testType, clientConfig.getKeyStoreType()); String trustStoreType = KeystoreType.JKS.toString().toLowerCase(); assertEquals(trustStoreType, clientConfig.getTrustStoreType()); assertEquals(TlsCertificateAuthorityClientCommandLine.KEYSTORE + testType.toLowerCase(), clientConfig.getKeyStore()); assertEquals(TlsCertificateAuthorityClientCommandLine.TRUSTSTORE + trustStoreType, clientConfig.getTrustStore()); }
public TlsClientConfig createClientConfig() throws IOException { String configJsonIn = getConfigJsonIn(); if (!StringUtils.isEmpty(configJsonIn)) { try (InputStream inputStream = inputStreamFactory.create(new File(configJsonIn))) { TlsClientConfig tlsClientConfig = new ObjectMapper().readValue(inputStream, TlsClientConfig.class); tlsClientConfig.initDefaults(); return tlsClientConfig; } } else { TlsClientConfig tlsClientConfig = new TlsClientConfig(); tlsClientConfig.setCaHostname(getCertificateAuthorityHostname()); tlsClientConfig.setDn(getDn()); tlsClientConfig.setDomainAlternativeNames(getDomainAlternativeNames()); tlsClientConfig.setToken(getToken()); tlsClientConfig.setPort(getPort()); tlsClientConfig.setKeyStore(KEYSTORE + getKeyStoreType().toLowerCase()); tlsClientConfig.setKeyStoreType(getKeyStoreType()); tlsClientConfig.setTrustStore(TRUSTSTORE + tlsClientConfig.getTrustStoreType().toLowerCase()); tlsClientConfig.setKeySize(getKeySize()); tlsClientConfig.setKeyPairAlgorithm(getKeyAlgorithm()); tlsClientConfig.setSigningAlgorithm(getSigningAlgorithm()); return tlsClientConfig; } }
TlsCertificateAuthorityClientCommandLine extends BaseCertificateAuthorityCommandLine { public TlsClientConfig createClientConfig() throws IOException { String configJsonIn = getConfigJsonIn(); if (!StringUtils.isEmpty(configJsonIn)) { try (InputStream inputStream = inputStreamFactory.create(new File(configJsonIn))) { TlsClientConfig tlsClientConfig = new ObjectMapper().readValue(inputStream, TlsClientConfig.class); tlsClientConfig.initDefaults(); return tlsClientConfig; } } else { TlsClientConfig tlsClientConfig = new TlsClientConfig(); tlsClientConfig.setCaHostname(getCertificateAuthorityHostname()); tlsClientConfig.setDn(getDn()); tlsClientConfig.setDomainAlternativeNames(getDomainAlternativeNames()); tlsClientConfig.setToken(getToken()); tlsClientConfig.setPort(getPort()); tlsClientConfig.setKeyStore(KEYSTORE + getKeyStoreType().toLowerCase()); tlsClientConfig.setKeyStoreType(getKeyStoreType()); tlsClientConfig.setTrustStore(TRUSTSTORE + tlsClientConfig.getTrustStoreType().toLowerCase()); tlsClientConfig.setKeySize(getKeySize()); tlsClientConfig.setKeyPairAlgorithm(getKeyAlgorithm()); tlsClientConfig.setSigningAlgorithm(getSigningAlgorithm()); return tlsClientConfig; } } }
TlsCertificateAuthorityClientCommandLine extends BaseCertificateAuthorityCommandLine { public TlsClientConfig createClientConfig() throws IOException { String configJsonIn = getConfigJsonIn(); if (!StringUtils.isEmpty(configJsonIn)) { try (InputStream inputStream = inputStreamFactory.create(new File(configJsonIn))) { TlsClientConfig tlsClientConfig = new ObjectMapper().readValue(inputStream, TlsClientConfig.class); tlsClientConfig.initDefaults(); return tlsClientConfig; } } else { TlsClientConfig tlsClientConfig = new TlsClientConfig(); tlsClientConfig.setCaHostname(getCertificateAuthorityHostname()); tlsClientConfig.setDn(getDn()); tlsClientConfig.setDomainAlternativeNames(getDomainAlternativeNames()); tlsClientConfig.setToken(getToken()); tlsClientConfig.setPort(getPort()); tlsClientConfig.setKeyStore(KEYSTORE + getKeyStoreType().toLowerCase()); tlsClientConfig.setKeyStoreType(getKeyStoreType()); tlsClientConfig.setTrustStore(TRUSTSTORE + tlsClientConfig.getTrustStoreType().toLowerCase()); tlsClientConfig.setKeySize(getKeySize()); tlsClientConfig.setKeyPairAlgorithm(getKeyAlgorithm()); tlsClientConfig.setSigningAlgorithm(getSigningAlgorithm()); return tlsClientConfig; } } TlsCertificateAuthorityClientCommandLine();  TlsCertificateAuthorityClientCommandLine(InputStreamFactory inputStreamFactory); }
TlsCertificateAuthorityClientCommandLine extends BaseCertificateAuthorityCommandLine { public TlsClientConfig createClientConfig() throws IOException { String configJsonIn = getConfigJsonIn(); if (!StringUtils.isEmpty(configJsonIn)) { try (InputStream inputStream = inputStreamFactory.create(new File(configJsonIn))) { TlsClientConfig tlsClientConfig = new ObjectMapper().readValue(inputStream, TlsClientConfig.class); tlsClientConfig.initDefaults(); return tlsClientConfig; } } else { TlsClientConfig tlsClientConfig = new TlsClientConfig(); tlsClientConfig.setCaHostname(getCertificateAuthorityHostname()); tlsClientConfig.setDn(getDn()); tlsClientConfig.setDomainAlternativeNames(getDomainAlternativeNames()); tlsClientConfig.setToken(getToken()); tlsClientConfig.setPort(getPort()); tlsClientConfig.setKeyStore(KEYSTORE + getKeyStoreType().toLowerCase()); tlsClientConfig.setKeyStoreType(getKeyStoreType()); tlsClientConfig.setTrustStore(TRUSTSTORE + tlsClientConfig.getTrustStoreType().toLowerCase()); tlsClientConfig.setKeySize(getKeySize()); tlsClientConfig.setKeyPairAlgorithm(getKeyAlgorithm()); tlsClientConfig.setSigningAlgorithm(getSigningAlgorithm()); return tlsClientConfig; } } TlsCertificateAuthorityClientCommandLine();  TlsCertificateAuthorityClientCommandLine(InputStreamFactory inputStreamFactory); static void main(String[] args); String getCertificateDirectory(); String getDomainAlternativeNames(); TlsClientConfig createClientConfig(); }
TlsCertificateAuthorityClientCommandLine extends BaseCertificateAuthorityCommandLine { public TlsClientConfig createClientConfig() throws IOException { String configJsonIn = getConfigJsonIn(); if (!StringUtils.isEmpty(configJsonIn)) { try (InputStream inputStream = inputStreamFactory.create(new File(configJsonIn))) { TlsClientConfig tlsClientConfig = new ObjectMapper().readValue(inputStream, TlsClientConfig.class); tlsClientConfig.initDefaults(); return tlsClientConfig; } } else { TlsClientConfig tlsClientConfig = new TlsClientConfig(); tlsClientConfig.setCaHostname(getCertificateAuthorityHostname()); tlsClientConfig.setDn(getDn()); tlsClientConfig.setDomainAlternativeNames(getDomainAlternativeNames()); tlsClientConfig.setToken(getToken()); tlsClientConfig.setPort(getPort()); tlsClientConfig.setKeyStore(KEYSTORE + getKeyStoreType().toLowerCase()); tlsClientConfig.setKeyStoreType(getKeyStoreType()); tlsClientConfig.setTrustStore(TRUSTSTORE + tlsClientConfig.getTrustStoreType().toLowerCase()); tlsClientConfig.setKeySize(getKeySize()); tlsClientConfig.setKeyPairAlgorithm(getKeyAlgorithm()); tlsClientConfig.setSigningAlgorithm(getSigningAlgorithm()); return tlsClientConfig; } } TlsCertificateAuthorityClientCommandLine();  TlsCertificateAuthorityClientCommandLine(InputStreamFactory inputStreamFactory); static void main(String[] args); String getCertificateDirectory(); String getDomainAlternativeNames(); TlsClientConfig createClientConfig(); static final String DESCRIPTION; static final String CERTIFICATE_DIRECTORY; static final String SUBJECT_ALTERNATIVE_NAMES; static final String DEFAULT_CERTIFICATE_DIRECTORY; }