Search in sources :

Example 26 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 27 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 28 with TrustManagersParameters

use of org.apache.camel.util.jsse.TrustManagersParameters 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 29 with TrustManagersParameters

use of org.apache.camel.util.jsse.TrustManagersParameters 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

TrustManagersParameters (org.apache.camel.util.jsse.TrustManagersParameters)29 KeyStoreParameters (org.apache.camel.util.jsse.KeyStoreParameters)28 SSLContextParameters (org.apache.camel.util.jsse.SSLContextParameters)27 KeyManagersParameters (org.apache.camel.util.jsse.KeyManagersParameters)21 JndiRegistry (org.apache.camel.impl.JndiRegistry)13 SSLContextServerParameters (org.apache.camel.util.jsse.SSLContextServerParameters)7 IOException (java.io.IOException)2 GeneralSecurityException (java.security.GeneralSecurityException)2 CertificateException (java.security.cert.CertificateException)2 X509Certificate (java.security.cert.X509Certificate)2 X509TrustManager (javax.net.ssl.X509TrustManager)2 InitialContext (javax.naming.InitialContext)1 TrustManager (javax.net.ssl.TrustManager)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 CipherSuitesParameters (org.apache.camel.util.jsse.CipherSuitesParameters)1 SSLContextClientParameters (org.apache.camel.util.jsse.SSLContextClientParameters)1 SecureSocketProtocolsParameters (org.apache.camel.util.jsse.SecureSocketProtocolsParameters)1 Before (org.junit.Before)1