@Override public boolean validateConfiguration(boolean needsKeyStore) { return super.validateConfiguration(needsKeyStore); }
@Override public boolean validateConfiguration(boolean needsKeyStore) { return super.validateConfiguration(needsKeyStore); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
/** * Validates {@link SSLContextConfigurator} configuration. * * @return <code>true</code> if configuration is valid, else * <code>false</code>. * * @deprecated Use {@link #createSSLContext(boolean)}. */ @Deprecated public boolean validateConfiguration() { return validateConfiguration(false); }
private SSLEngineConfigurator buildSslEngineConfigurator(Path certFile, Path keyFile, String keyPassword) throws GeneralSecurityException, IOException { if (keyFile == null || !Files.isRegularFile(keyFile) || !Files.isReadable(keyFile)) { throw new InvalidKeyException("Unreadable or missing private key: " + keyFile); } if (certFile == null || !Files.isRegularFile(certFile) || !Files.isReadable(certFile)) { throw new CertificateException("Unreadable or missing X.509 certificate: " + certFile); } final SSLContextConfigurator sslContext = new SSLContextConfigurator(); final char[] password = firstNonNull(keyPassword, "").toCharArray(); final KeyStore keyStore = PemKeyStore.buildKeyStore(certFile, keyFile, password); sslContext.setKeyStorePass(password); sslContext.setKeyStoreBytes(KeyStoreUtils.getBytes(keyStore, password)); if (!sslContext.validateConfiguration(true)) { throw new IllegalStateException("Couldn't initialize SSL context for HTTP server"); } return new SSLEngineConfigurator(sslContext.createSSLContext(false), false, false, false); }
SSLContextConfigurator sslContextConfigurator = new SSLContextConfigurator(); // set up security context sslContextConfigurator.setKeyStoreFile(configuration.getKeystore()); // contains the server keypair sslContextConfigurator.setKeyStorePass(configuration.getKeystorePassword()); sslContextConfigurator.setKeyStoreType(configuration.getKeystoreType()); sslContextConfigurator.setKeyPass(configuration.getKeystoreKeypass()); sslContextConfigurator.setTrustStoreFile(configuration.getTruststore()); // contains the list of trusted certificates sslContextConfigurator.setTrustStorePass(configuration.getTruststorePassword()); sslContextConfigurator.setTrustStoreType(configuration.getTruststoreType()); if (!sslContextConfigurator.validateConfiguration(true)) throw new Exception("Invalid SSL configuration");
@SuppressWarnings("squid:S2177") private SSLContextConfigurator getSslConfig() throws IOException { SSLContextConfigurator defaultConfig = SSLContextConfigurator.DEFAULT_CONFIG; if (!defaultConfig.validateConfiguration(true)) { String keystoreServer = createCertificateStore("keystore_server"); String truststoreServer = createCertificateStore("truststore_server"); defaultConfig.setKeyStoreFile(keystoreServer); defaultConfig.setKeyStorePass("secret"); defaultConfig.setTrustStoreFile(truststoreServer); defaultConfig.setTrustStorePass("secret"); } return defaultConfig; }
private SSLContextConfigurator getSslConfig() throws IOException { if(SSLContextConfigurator.DEFAULT_CONFIG.validateConfiguration(true)) { return SSLContextConfigurator.DEFAULT_CONFIG; } SSLContextConfigurator defaultConfig = SSLContextConfigurator.DEFAULT_CONFIG; String keystore_server = createCertificateStore("keystore_server"); String truststore_server = createCertificateStore("truststore_server"); defaultConfig.setKeyStoreFile(keystore_server); defaultConfig.setKeyStorePass("secret"); defaultConfig.setTrustStoreFile(truststore_server); defaultConfig.setTrustStorePass("secret"); return defaultConfig; }
SSLEngineConfigurator serverSSLEngineConfigurator = null; if (sslContextConfigurator.validateConfiguration(true)) { clientSSLEngineConfigurator = new SSLEngineConfigurator(sslContextConfigurator.createSSLContext(true));
SSLEngineConfigurator serverSSLEngineConfigurator = null; if (sslContextConfigurator.validateConfiguration(true)) { clientSSLEngineConfigurator = new SSLEngineConfigurator(sslContextConfigurator.createSSLContext(true));