private SSLSocketFactory tryToGetSSLSocketFactory() { try { return sslContextParameters.createSSLContext(camelContext) .getSocketFactory(); } catch (GeneralSecurityException | IOException e) { throw new RuntimeException("Setting SSL failed", e); } } }
@Bean SSLContextParameters ssl() { TrustManagersParameters trustManagersParameters = new TrustManagersParameters(); X509ExtendedTrustManager extendedTrustManager = new InsecureX509TrustManager(); trustManagersParameters.setTrustManager(extendedTrustManager); SSLContextParameters scp = new SSLContextParameters(); scp.setTrustManagers(trustManagersParameters); return scp; }
public CipherSuitesParameters getCipherSuites() { return config.getCipherSuites(); }
private static LinkedInOAuthRequestFilter createRequestFilter(LinkedInConfiguration configuration) { // validate configuration configuration.validate(); final String[] enabledProtocols; try { // use default SSP to create supported non-SSL protocols list final SSLContext sslContext = new SSLContextParameters().createSSLContext(); enabledProtocols = sslContext.createSSLEngine().getEnabledProtocols(); } catch (GeneralSecurityException e) { throw ObjectHelper.wrapRuntimeCamelException(e); } catch (IOException e) { throw ObjectHelper.wrapRuntimeCamelException(e); } return new LinkedInOAuthRequestFilter(getOAuthParams(configuration), configuration.getHttpParams(), configuration.isLazyAuth(), enabledProtocols); }
sccp.setCipherSuites(csp); SSLContextParameters scp = new SSLContextParameters(); scp.setCertAlias(sslConfig.getKeyAlias()); scp.setKeyManagers(kmp); scp.setTrustManagers(tmp); scp.setServerParameters(scsp); scp.setClientParameters(sccp);
addPropertyIfNotNull(props, SslConfigs.SSL_PROTOCOL_CONFIG, sslContextParameters.getSecureSocketProtocol()); addPropertyIfNotNull(props, SslConfigs.SSL_PROVIDER_CONFIG, sslContextParameters.getProvider()); CipherSuitesParameters cipherSuites = sslContextParameters.getCipherSuites(); if (cipherSuites != null) { addCommaSeparatedList(props, SslConfigs.SSL_CIPHER_SUITES_CONFIG, cipherSuites.getCipherSuite()); SecureSocketProtocolsParameters secureSocketProtocols = sslContextParameters.getSecureSocketProtocols(); if (secureSocketProtocols != null) { addCommaSeparatedList(props, SslConfigs.SSL_ENABLED_PROTOCOLS_CONFIG, secureSocketProtocols.getSecureSocketProtocol()); KeyManagersParameters keyManagers = sslContextParameters.getKeyManagers(); if (keyManagers != null) { addPropertyIfNotNull(props, SslConfigs.SSL_KEYMANAGER_ALGORITHM_CONFIG, keyManagers.getAlgorithm()); TrustManagersParameters trustManagers = sslContextParameters.getTrustManagers(); if (trustManagers != null) { addPropertyIfNotNull(props, SslConfigs.SSL_TRUSTMANAGER_ALGORITHM_CONFIG, trustManagers.getAlgorithm());
private void configureSslForJetty() { KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("c:\\Projects\\blah\\fakefilter.jks"); ksp.setPassword("123456"); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyStore(ksp); kmp.setKeyPassword("export-password"); SSLContextParameters scp = new SSLContextParameters(); scp.setKeyManagers(kmp); JettyHttpComponent jettyComponent = getContext().getComponent("jetty", JettyHttpComponent.class); jettyComponent.setSslContextParameters(scp); }
ObjectHelper.notNull(sslParameters.getSecureSocketProtocol(), "Security protocol"); ObjectHelper.notNull(sslParameters.getTrustManagers().getKeyStore().getResource(), "Trust store path"); ObjectHelper.notNull(sslParameters.getTrustManagers().getKeyStore().getPassword(), "Trust store password"); sslParams = new TSSLTransportFactory.TSSLTransportParameters(sslParameters.getSecureSocketProtocol(), sslParameters.getCipherSuites() == null ? null : sslParameters.getCipherSuites().getCipherSuite().stream().toArray(String[]::new)); if (ObjectHelper.isNotEmpty(sslParameters.getTrustManagers().getProvider()) && ObjectHelper.isNotEmpty(sslParameters.getTrustManagers().getKeyStore().getType())) { sslParams.setTrustStore(sslParameters.getTrustManagers().getKeyStore().getResource(), sslParameters.getTrustManagers().getKeyStore().getPassword(), sslParameters.getTrustManagers().getProvider(), sslParameters.getTrustManagers().getKeyStore().getType()); } else { sslParams.setTrustStore(sslParameters.getTrustManagers().getKeyStore().getResource(), sslParameters.getTrustManagers().getKeyStore().getPassword());
@Bean public GlobalSSLContextParametersSupplier sslContextParametersSupplier(CamelSSLConfigurationProperties properties) { final SSLContextParameters config = properties.getConfig() != null ? properties.getConfig() : new SSLContextParameters(); return () -> config; }
ObjectHelper.notNull(sslParameters.getSecureSocketProtocol(), "Security protocol"); ObjectHelper.notNull(sslParameters.getKeyManagers().getKeyStore().getResource(), "Keystore path"); ObjectHelper.notNull(sslParameters.getKeyManagers().getKeyStore().getPassword(), "Keystore password"); sslParams = new TSSLTransportFactory.TSSLTransportParameters(sslParameters.getSecureSocketProtocol(), sslParameters.getCipherSuites() == null ? null : sslParameters.getCipherSuites().getCipherSuite().stream().toArray(String[]::new)); if (ObjectHelper.isNotEmpty(sslParameters.getKeyManagers().getKeyStore().getProvider()) && ObjectHelper.isNotEmpty(sslParameters.getKeyManagers().getKeyStore().getType())) { sslParams.setKeyStore(sslParameters.getKeyManagers().getKeyStore().getResource(), sslParameters.getKeyManagers().getKeyStore().getPassword(), sslParameters.getKeyManagers().getKeyStore().getProvider(), sslParameters.getKeyManagers().getKeyStore().getType()); } else { sslParams.setKeyStore(sslParameters.getKeyManagers().getKeyStore().getResource(), sslParameters.getKeyManagers().getKeyStore().getPassword());
public void setTrustManagers(TrustManagersParameters trustManagers) { config.setTrustManagers(trustManagers); }
public KeyManagersParameters getKeyManagers() { return config.getKeyManagers(); }
public String getSecureSocketProtocol() { return config.getSecureSocketProtocol(); }
private LinkedInOAuthRequestFilter createRequestFilter(LinkedInConfiguration configuration) { // validate configuration configuration.validate(); final String[] enabledProtocols; try { // use default SSP to create supported non-SSL protocols list final SSLContext sslContext = new SSLContextParameters().createSSLContext(getCamelContext()); enabledProtocols = sslContext.createSSLEngine().getEnabledProtocols(); } catch (GeneralSecurityException e) { throw ObjectHelper.wrapRuntimeCamelException(e); } catch (IOException e) { throw ObjectHelper.wrapRuntimeCamelException(e); } return new LinkedInOAuthRequestFilter(getOAuthParams(configuration), configuration.getHttpParams(), configuration.isLazyAuth(), enabledProtocols); }
private SSLContext createSSLContext() { try { return sslContextParameters.createSSLContext(); } catch (Exception e) { throw new RuntimeCamelException("Error initializing SSLContext.", e); } }
if (sslContextParameters == null) { sslContextParameters = new SSLContextParameters(); clientBuilder.setSSLContext(sslContextParameters.createSSLContext()); } catch (GeneralSecurityException e) { throw ObjectHelper.wrapRuntimeCamelException(e);
private void configureSslForHttp4() { KeyStoreParameters trust_ksp = new KeyStoreParameters(); trust_ksp.setResource("c:\\Projects\\blah\\fakeca.jks"); trust_ksp.setPassword("123456"); TrustManagersParameters trustp = new TrustManagersParameters(); trustp.setKeyStore(trust_ksp); SSLContextParameters scp = new SSLContextParameters(); scp.setTrustManagers(trustp); HttpComponent httpComponent = getContext().getComponent("https4", HttpComponent.class); httpComponent.setSslContextParameters(scp); }
/** * Creates a new instance using a factory created by the provided client configuration * parameters. * * @param params the configuration parameters to use when creating the socket factory * @param camelContext the Camel context */ public SSLContextParametersSecureProtocolSocketFactory(SSLContextParameters params, CamelContext camelContext) { try { this.context = params.createSSLContext(camelContext); this.factory = this.context.getSocketFactory(); } catch (Exception e) { throw new RuntimeCamelException("Error creating the SSLContext.", e); } }
sslContextParameters = new SSLContextParameters(); asyncClientBuilder.setSSLContext(sslContextParameters.createSSLContext(getCamelContext())); } catch (GeneralSecurityException e) { throw ObjectHelper.wrapRuntimeCamelException(e);
TrustManagersParameters trustp = new TrustManagersParameters(); trustp.setKeyStore(trust_ksp); SSLContextParameters scp = new SSLContextParameters(); scp.setTrustManagers(trustp); HttpComponent httpComponent = getContext().getComponent("https4", HttpComponent.class); httpComponent.setSslContextParameters(scp);