Search in sources :

Example 11 with TrustManagersParameters

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

the class IrcsWithSslContextParamsRouteTest method createRegistry.

// TODO This test is disabled until we can find a public SSL enabled IRC 
// server to test against. To use this test, follow the following procedures:
// 1) Download and install UnrealIRCd 3.2.9 from http://www.unrealircd.com/
// 2) Copy the contents of the src/test/unrealircd folder into the installation
//    folder of UnrealIRCd.
// 3) Start UnrealIRCd and execute this test.  Often the test executes quicker than
//    the IRC server responds and the assertion will fail.  In order to get the test to
//    pass reliably, you may need to set a break point in IrcEndpoint#joinChanel in order
//    to slow the route creation down enough for the event listener to be in place
//    when camel-con joins the room.
@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("localhost.ks");
    ksp.setPassword("changeit");
    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);
    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setTrustManagers(tmp);
    JndiRegistry registry = super.createRegistry();
    registry.bind("sslContextParameters", sslContextParameters);
    return registry;
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) TrustManagersParameters(org.apache.camel.util.jsse.TrustManagersParameters) KeyStoreParameters(org.apache.camel.util.jsse.KeyStoreParameters) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Example 12 with TrustManagersParameters

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

the class LumberjackComponentSSLTest method createClientSSLContextParameters.

private SSLContextParameters createClientSSLContextParameters() {
    SSLContextParameters sslContextParameters = new SSLContextParameters();
    TrustManagersParameters trustManagersParameters = new TrustManagersParameters();
    KeyStoreParameters trustStore = new KeyStoreParameters();
    trustStore.setPassword("changeit");
    trustStore.setResource("org/apache/camel/component/lumberjack/keystore.jks");
    trustManagersParameters.setKeyStore(trustStore);
    sslContextParameters.setTrustManagers(trustManagersParameters);
    return sslContextParameters;
}
Also used : TrustManagersParameters(org.apache.camel.util.jsse.TrustManagersParameters) KeyStoreParameters(org.apache.camel.util.jsse.KeyStoreParameters) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Example 13 with TrustManagersParameters

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

the class WebsocketSSLContextInUriRouteExampleTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("jsse/localhost.ks");
    ksp.setPassword(pwd);
    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword(pwd);
    kmp.setKeyStore(ksp);
    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);
    // NOTE: Needed since the client uses a loose trust configuration when no ssl context
    // is provided.  We turn on WANT client-auth to prefer using authentication
    SSLContextServerParameters scsp = new SSLContextServerParameters();
    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);
    sslContextParameters.setServerParameters(scsp);
    JndiRegistry registry = super.createRegistry();
    registry.bind("sslContextParameters", sslContextParameters);
    return registry;
}
Also used : KeyManagersParameters(org.apache.camel.util.jsse.KeyManagersParameters) JndiRegistry(org.apache.camel.impl.JndiRegistry) TrustManagersParameters(org.apache.camel.util.jsse.TrustManagersParameters) KeyStoreParameters(org.apache.camel.util.jsse.KeyStoreParameters) SSLContextServerParameters(org.apache.camel.util.jsse.SSLContextServerParameters) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Example 14 with TrustManagersParameters

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

the class WebsocketSSLRouteExampleTest method defineSSLContextParameters.

protected SSLContextParameters defineSSLContextParameters() {
    KeyStoreParameters ksp = new KeyStoreParameters();
    // ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString());
    ksp.setResource("jsse/localhost.ks");
    ksp.setPassword(pwd);
    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword(pwd);
    kmp.setKeyStore(ksp);
    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);
    // NOTE: Needed since the client uses a loose trust configuration when no ssl context
    // is provided.  We turn on WANT client-auth to prefer using authentication
    SSLContextServerParameters scsp = new SSLContextServerParameters();
    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);
    sslContextParameters.setServerParameters(scsp);
    return sslContextParameters;
}
Also used : KeyManagersParameters(org.apache.camel.util.jsse.KeyManagersParameters) TrustManagersParameters(org.apache.camel.util.jsse.TrustManagersParameters) KeyStoreParameters(org.apache.camel.util.jsse.KeyStoreParameters) SSLContextServerParameters(org.apache.camel.util.jsse.SSLContextServerParameters) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Example 15 with TrustManagersParameters

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

the class StompBaseTest method getSSLContextParameters.

private SSLContextParameters getSSLContextParameters(String path, String password) {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(path);
    ksp.setPassword(password);
    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword(password);
    kmp.setKeyStore(ksp);
    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);
    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);
    return sslContextParameters;
}
Also used : KeyManagersParameters(org.apache.camel.util.jsse.KeyManagersParameters) TrustManagersParameters(org.apache.camel.util.jsse.TrustManagersParameters) KeyStoreParameters(org.apache.camel.util.jsse.KeyStoreParameters) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Aggregations

TrustManagersParameters (org.apache.camel.util.jsse.TrustManagersParameters)25 KeyStoreParameters (org.apache.camel.util.jsse.KeyStoreParameters)24 SSLContextParameters (org.apache.camel.util.jsse.SSLContextParameters)23 KeyManagersParameters (org.apache.camel.util.jsse.KeyManagersParameters)17 JndiRegistry (org.apache.camel.impl.JndiRegistry)13 SSLContextServerParameters (org.apache.camel.util.jsse.SSLContextServerParameters)7 IOException (java.io.IOException)1 GeneralSecurityException (java.security.GeneralSecurityException)1 CertificateException (java.security.cert.CertificateException)1 X509Certificate (java.security.cert.X509Certificate)1 TrustManager (javax.net.ssl.TrustManager)1 X509TrustManager (javax.net.ssl.X509TrustManager)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 CipherSuitesParameters (org.apache.camel.util.jsse.CipherSuitesParameters)1 SecureSocketProtocolsParameters (org.apache.camel.util.jsse.SecureSocketProtocolsParameters)1