Search in sources :

Example 21 with KeyManagersParameters

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

the class HttpsRouteAliasTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        public void configure() throws URISyntaxException {
            JettyHttpComponent jetty = context.getComponent("jetty", JettyHttpComponent.class);
            KeyStoreParameters ksp = new KeyStoreParameters();
            ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost-alias.ks").toString());
            ksp.setPassword(pwd);
            KeyManagersParameters kmp = new KeyManagersParameters();
            kmp.setKeyPassword(pwd);
            kmp.setKeyStore(ksp);
            SSLContextParameters sslContextParameters = new SSLContextParameters();
            sslContextParameters.setKeyManagers(kmp);
            // Specify "server" cert alias
            sslContextParameters.setCertAlias("server");
            jetty.setSslContextParameters(sslContextParameters);
            setSSLProps(jetty, "", "asdfasdfasdfdasfs", "sadfasdfasdfas");
            from("jetty:https://localhost:" + port1 + "/test").to("mock:a");
            Processor proc = new Processor() {

                public void process(Exchange exchange) throws Exception {
                    exchange.getOut().setBody("<b>Hello World</b>");
                }
            };
            from("jetty:https://localhost:" + port1 + "/hello").process(proc);
            from("jetty:https://localhost:" + port2 + "/test").to("mock:b");
        }
    };
}
Also used : KeyManagersParameters(org.apache.camel.util.jsse.KeyManagersParameters) Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) RouteBuilder(org.apache.camel.builder.RouteBuilder) KeyStoreParameters(org.apache.camel.util.jsse.KeyStoreParameters) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Example 22 with KeyManagersParameters

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

the class NettySSLContextParametersTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(this.getClass().getClassLoader().getResource("keystore.jks").toString());
    ksp.setPassword("changeit");
    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword("changeit");
    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();
    scsp.setClientAuthentication(ClientAuthentication.WANT.name());
    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 23 with KeyManagersParameters

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

the class FileToFtpsExplicitSSLWithClientAuthAndSSLContextParametersTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("server.jks");
    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.setSecureSocketProtocol("SSL");
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);
    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) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Example 24 with KeyManagersParameters

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

the class FileToFtpsExplicitTLSWithClientAuthAndSSLContextParametersTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("server.jks");
    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.setSecureSocketProtocol("TLS");
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);
    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) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Example 25 with KeyManagersParameters

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

the class FileToFtpsImplicitSSLWithClientAuthAndSSLContextParametersTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("server.jks");
    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.setSecureSocketProtocol("SSL");
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);
    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) SSLContextParameters(org.apache.camel.util.jsse.SSLContextParameters)

Aggregations

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