Search in sources :

Example 56 with SSLContextParameters

use of org.apache.camel.util.jsse.SSLContextParameters in project camel by apache.

the class LumberjackComponentSSLTest method createServerSSLContextParameters.

/**
     * Creates the {@link SSLContextParameters} Camel object for the Lumberjack component
     *
     * @return The {@link SSLContextParameters} Camel object for the Lumberjack component
     */
private SSLContextParameters createServerSSLContextParameters() {
    SSLContextParameters sslContextParameters = new SSLContextParameters();
    KeyManagersParameters keyManagersParameters = new KeyManagersParameters();
    KeyStoreParameters keyStore = new KeyStoreParameters();
    keyStore.setPassword("changeit");
    keyStore.setResource("org/apache/camel/component/lumberjack/keystore.jks");
    keyManagersParameters.setKeyPassword("changeit");
    keyManagersParameters.setKeyStore(keyStore);
    sslContextParameters.setKeyManagers(keyManagersParameters);
    return sslContextParameters;
}
Also used : KeyManagersParameters(org.apache.camel.util.jsse.KeyManagersParameters) KeyStoreParameters(org.apache.camel.util.jsse.KeyStoreParameters) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Example 57 with SSLContextParameters

use of org.apache.camel.util.jsse.SSLContextParameters in project camel by apache.

the class LinkedInComponent method createRequestFilter.

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);
}
Also used : GeneralSecurityException(java.security.GeneralSecurityException) LinkedInOAuthRequestFilter(org.apache.camel.component.linkedin.api.LinkedInOAuthRequestFilter) SSLContext(javax.net.ssl.SSLContext) IOException(java.io.IOException) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Example 58 with SSLContextParameters

use of org.apache.camel.util.jsse.SSLContextParameters in project wildfly-camel by wildfly-extras.

the class ApnsUtils method clientContext.

public static SSLContextParameters clientContext() throws Exception {
    final KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(ApnsUtils.class.getResource("/" + FixedCertificates.CLIENT_STORE).toString());
    ksp.setType("PKCS12");
    final KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyStore(ksp);
    kmp.setKeyPassword(FixedCertificates.CLIENT_PASSWORD);
    kmp.setAlgorithm(getAlgorithm());
    final SSLContextParameters contextParameters = new SSLContextParameters();
    contextParameters.setKeyManagers(kmp);
    contextParameters.setTrustManagers(new TrustManagersParameters() {

        @Override
        public TrustManager[] createTrustManagers() throws GeneralSecurityException, IOException {
            return new TrustManager[] { new X509TrustManager() {

                public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                }

                public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                }

                public X509Certificate[] getAcceptedIssuers() {
                    return new X509Certificate[0];
                }
            } };
        }
    });
    return contextParameters;
}
Also used : KeyManagersParameters(org.apache.camel.util.jsse.KeyManagersParameters) X509TrustManager(javax.net.ssl.X509TrustManager) GeneralSecurityException(java.security.GeneralSecurityException) TrustManagersParameters(org.apache.camel.util.jsse.TrustManagersParameters) KeyStoreParameters(org.apache.camel.util.jsse.KeyStoreParameters) CertificateException(java.security.cert.CertificateException) IOException(java.io.IOException) X509Certificate(java.security.cert.X509Certificate) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Example 59 with SSLContextParameters

use of org.apache.camel.util.jsse.SSLContextParameters in project wildfly-camel by wildfly-extras.

the class SecureNettyIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("/" + KEYSTORE);
    ksp.setPassword(KEYSTORE_PASSWORD);
    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword(KEYSTORE_PASSWORD);
    kmp.setKeyStore(ksp);
    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);
    SSLContextParameters scp = new SSLContextParameters();
    scp.setKeyManagers(kmp);
    scp.setTrustManagers(tmp);
    InitialContext context = new InitialContext();
    context.bind("sslContextParameters", scp);
}
Also used : KeyManagersParameters(org.apache.camel.util.jsse.KeyManagersParameters) TrustManagersParameters(org.apache.camel.util.jsse.TrustManagersParameters) KeyStoreParameters(org.apache.camel.util.jsse.KeyStoreParameters) InitialContext(javax.naming.InitialContext) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters) Before(org.junit.Before)

Aggregations

SSLContextParameters (org.apache.camel.util.jsse.SSLContextParameters)59 KeyStoreParameters (org.apache.camel.util.jsse.KeyStoreParameters)35 KeyManagersParameters (org.apache.camel.util.jsse.KeyManagersParameters)28 TrustManagersParameters (org.apache.camel.util.jsse.TrustManagersParameters)27 JndiRegistry (org.apache.camel.impl.JndiRegistry)19 SslContextFactory (org.eclipse.jetty.util.ssl.SslContextFactory)8 IOException (java.io.IOException)7 GeneralSecurityException (java.security.GeneralSecurityException)7 SSLContextServerParameters (org.apache.camel.util.jsse.SSLContextServerParameters)7 RouteBuilder (org.apache.camel.builder.RouteBuilder)6 SSLContext (javax.net.ssl.SSLContext)5 Test (org.junit.Test)4 URI (java.net.URI)3 SalesforceException (org.apache.camel.component.salesforce.api.SalesforceException)3 SalesforceSession (org.apache.camel.component.salesforce.internal.SalesforceSession)3 HttpClient (org.eclipse.jetty.client.HttpClient)3 JdkSslContext (io.netty.handler.ssl.JdkSslContext)2 URISyntaxException (java.net.URISyntaxException)2 CertificateException (java.security.cert.CertificateException)2 X509Certificate (java.security.cert.X509Certificate)2