Java 类org.apache.camel.util.jsse.TrustManagersParameters 实例源码

项目:bitbreeds-webrtc    文件:SimpleSignalingExample.java   
/**
 *
 * @return certificate paramters for tls
 * @throws GeneralSecurityException
 * @throws IOException
 */
public static SSLContextParameters sslParameters() throws GeneralSecurityException, IOException {
    String storePath = System.getProperty(ServerProperties.KEYSTORE);
    String alias = System.getProperty(ServerProperties.ALIAS);
    String pass = System.getProperty(ServerProperties.PASS);

    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(storePath);
    ksp.setPassword(pass);

    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyStore(ksp);
    kmp.setKeyPassword(pass);

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters scp = new SSLContextParameters();
    scp.setKeyManagers(kmp);
    scp.setTrustManagers(tmp);
    return scp;
}
项目:bitbreeds-webrtc    文件:SimpleSignalingExample.java   
/**
 *
 * @return certificate paramters for tls
 * @throws GeneralSecurityException
 * @throws IOException
 */
public static SSLContextParameters sslParameters() throws GeneralSecurityException, IOException {
    String storePath = System.getProperty(ServerProperties.KEYSTORE);
    String alias = System.getProperty(ServerProperties.ALIAS);
    String pass = System.getProperty(ServerProperties.PASS);

    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(storePath);
    ksp.setPassword(pass);

    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyStore(ksp);
    kmp.setKeyPassword(pass);

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters scp = new SSLContextParameters();
    scp.setKeyManagers(kmp);
    scp.setTrustManagers(tmp);
    return scp;
}
项目:wildfly-camel-examples    文件:Application.java   
private SSLContextParameters createProducerSSLContextParameters() {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(KEYSTORE_PATH);
    ksp.setPassword(KEYSTORE_PASSWORD);

    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyStore(ksp);
    kmp.setKeyPassword(KEYSTORE_PASSWORD);

    SSLContextClientParameters sslContextClientParameters = new SSLContextClientParameters();
    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setClientParameters(sslContextClientParameters);
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setCertAlias(TRUSTSTORE_ALIAS_NAME);

    // so that the client trusts the self-signed server certificate
    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);
    sslContextParameters.setTrustManagers(tmp);

    return sslContextParameters;
}
项目:wildfly-camel-examples    文件:Application.java   
private SSLContextParameters createConsumerSSLContextParameters() {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(KEYSTORE_PATH);
    ksp.setPassword(KEYSTORE_PASSWORD);

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextServerParameters sslContextServerParameters = new SSLContextServerParameters();
    sslContextServerParameters.setClientAuthentication(ClientAuthentication.REQUIRE.name());
    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setServerParameters(sslContextServerParameters);
    sslContextParameters.setTrustManagers(tmp);

    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyStore(ksp);
    kmp.setKeyPassword(KEYSTORE_PASSWORD);
    sslContextParameters.setKeyManagers(kmp);

    return sslContextParameters;
}
项目:Camel    文件:FileToFtpsImplicitSSLWithClientAuthAndSSLContextParametersTest.java   
@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;
}
项目:Camel    文件:FileToFtpsImplicitSSLWithoutClientAuthAndSSLContextParametersTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("server.jks");
    ksp.setPassword("password");

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setSecureSocketProtocol("SSL");
    sslContextParameters.setTrustManagers(tmp);

    JndiRegistry registry = super.createRegistry();
    registry.bind("sslContextParameters", sslContextParameters);
    return registry;
}
项目:Camel    文件:FileToFtpsExplicitSSLWithClientAuthAndSSLContextParametersTest.java   
@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;
}
项目:Camel    文件:FileToFtpsExplicitSSLWithoutClientAuthAndSSLContextParametersTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("server.jks");
    ksp.setPassword("password");

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setSecureSocketProtocol("SSL");
    sslContextParameters.setTrustManagers(tmp);

    JndiRegistry registry = super.createRegistry();
    registry.bind("sslContextParameters", sslContextParameters);
    return registry;
}
项目:Camel    文件:FileToFtpsExplicitTLSWithoutClientAuthAndSSLContextParametersTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("server.jks");
    ksp.setPassword("password");

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setSecureSocketProtocol("TLS");
    sslContextParameters.setTrustManagers(tmp);

    JndiRegistry registry = super.createRegistry();
    registry.bind("sslContextParameters", sslContextParameters);
    return registry;
}
项目:Camel    文件:FileToFtpsImplicitTLSWithoutClientAuthAndSSLContextParametersTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("server.jks");
    ksp.setPassword("password");

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setSecureSocketProtocol("TLS");
    sslContextParameters.setTrustManagers(tmp);

    JndiRegistry registry = super.createRegistry();
    registry.bind("sslContextParameters", sslContextParameters);
    return registry;
}
项目:Camel    文件:FileToFtpsExplicitTLSWithClientAuthAndSSLContextParametersTest.java   
@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;
}
项目:Camel    文件:FileToFtpsImplicitTLSWithClientAuthAndSSLContextParametersTest.java   
@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;
}
项目:Camel    文件:AbstractTrustManagersParametersFactoryBean.java   
protected TrustManagersParameters createInstance() throws Exception {
    TrustManagersParameters newInstance = new TrustManagersParameters();

    newInstance.setAlgorithm(algorithm);
    if (getKeyStore() != null) {
        getKeyStore().setCamelContext(getCamelContext());
        newInstance.setKeyStore(getKeyStore().getObject());
    }
    newInstance.setProvider(provider);
    newInstance.setCamelContext(getCamelContext());

    if (trustManager != null) {
        TrustManager tm = CamelContextHelper.mandatoryLookup(getCamelContext(), trustManager, TrustManager.class);
        newInstance.setTrustManager(tm);
    }

    return newInstance;
}
项目:Camel    文件:IrcsWithSslContextParamsRouteTest.java   
@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;
}
项目:Camel    文件:WebsocketSSLContextInUriRouteExampleTest.java   
@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;
}
项目:Camel    文件:WebsocketSSLRouteExampleTest.java   
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;
    }
项目:Camel    文件:WssProducerTest.java   
private static SSLContextParameters defineSSLContextServerParameters() {

        KeyStoreParameters ksp = new KeyStoreParameters();
        ksp.setResource("jsse/localhost.ks");
        ksp.setPassword(PW);

        KeyManagersParameters kmp = new KeyManagersParameters();
        kmp.setKeyPassword(PW);
        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);

        return sslContextParameters;
    }
项目:Camel    文件:MailTestHelper.java   
public static SSLContextParameters createSslContextParameters() {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(MailTestHelper.class.getClassLoader().getResource("jsse/localhost.ks").toString());
    ksp.setPassword(KEY_STORE_PASSWORD);

    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword(KEY_STORE_PASSWORD);
    kmp.setKeyStore(ksp);

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);

    return sslContextParameters;
}
项目:Camel    文件:StompBaseTest.java   
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;
}
项目:Camel    文件:BaseMina2Test.java   
protected void addSslContextParametersToRegistry(JndiRegistry registry) {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString());
    ksp.setPassword(KEY_STORE_PASSWORD);

    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword(KEY_STORE_PASSWORD);
    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);

    registry.bind("sslContextParameters", sslContextParameters);
}
项目:Camel    文件:SslContextParametersInUriCometdProducerConsumerTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("jsse/localhost.ks");
    ksp.setPassword("changeit");

    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword("changeit");
    kmp.setKeyStore(ksp);

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);

    JndiRegistry registry = super.createRegistry();
    registry.bind("sslContextParameters", sslContextParameters);
    return registry;
}
项目:camelinaction2    文件:HttpsTest.java   
@Override
protected JndiRegistry createRegistry() throws Exception {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("./cia_keystore.jks");
    ksp.setPassword("supersecret");
    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword("secret");
    kmp.setKeyStore(ksp);

    KeyStoreParameters tsp = new KeyStoreParameters();
    tsp.setResource("./cia_truststore.jks");
    tsp.setPassword("supersecret");      
    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(tsp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);

    JndiRegistry registry = super.createRegistry();
    registry.bind("ssl", sslContextParameters);

    return registry;
}
项目:camelinaction2    文件:GlobalSSLContextParametersTest.java   
private SSLContextParameters createSSLContextParameters() {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("./cia_keystore.jks");
    ksp.setPassword("supersecret");
    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword("secret");
    kmp.setKeyStore(ksp);

    KeyStoreParameters tsp = new KeyStoreParameters();
    tsp.setResource("./cia_truststore.jks");
    tsp.setPassword("supersecret");      
    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(tsp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setKeyManagers(kmp);
    sslContextParameters.setTrustManagers(tmp);

    return sslContextParameters;
}
项目:wildfly-camel    文件:AhcWSSIntegrationTest.java   
private static SSLContextParameters defineSSLContextClientParameters() {

        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);

        return scp;
    }
项目:wildfly-camel    文件:SecureNettyIntegrationTest.java   
@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);
}
项目:wildfly-camel    文件:CXFWSSecureConsumerIntegrationTest.java   
private SSLContextParameters createSSLContextParameters() {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(System.getProperty("jboss.server.config.dir") + "/application.keystore");
    ksp.setPassword("password");

    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyStore(ksp);
    kmp.setKeyPassword("password");

    SSLContextClientParameters sslContextClientParameters = new SSLContextClientParameters();
    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setClientParameters(sslContextClientParameters);
    sslContextParameters.setKeyManagers(kmp);

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);
    sslContextParameters.setTrustManagers(tmp);

    return sslContextParameters;
}
项目:Camel    文件:AbstractTrustManagersParametersFactoryBean.java   
@Override
public TrustManagersParameters getObject() throws Exception {
    if (isSingleton()) {
        if (instance == null) { 
            instance = createInstance();   
        }
        return instance;
    } else {
        return createInstance();
    }   
}
项目:Camel    文件:NettySSLContextParametersTest.java   
@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;
}
项目:Camel    文件:WssProducerTest.java   
private static SSLContextParameters defineSSLContextClientParameters() {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource("jsse/localhost.ks");
    ksp.setPassword(PW);

    TrustManagersParameters tmp = new TrustManagersParameters();
    tmp.setKeyStore(ksp);

    SSLContextParameters sslContextParameters = new SSLContextParameters();
    sslContextParameters.setTrustManagers(tmp);

    return sslContextParameters;
}
项目:Camel    文件:NettySSLContextParametersTest.java   
@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;
}
项目:Camel    文件:BaseAhcTest.java   
protected void addSslContextParametersToRegistry(JndiRegistry registry) {
    KeyStoreParameters ksp = new KeyStoreParameters();
    ksp.setResource(this.getClass().getClassLoader().getResource("jsse/localhost.ks").toString());
    ksp.setPassword(KEY_STORE_PASSWORD);

    KeyManagersParameters kmp = new KeyManagersParameters();
    kmp.setKeyPassword(KEY_STORE_PASSWORD);
    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);
    // use SSLv3 to avoid issue with (eg disable TLS)
    // Caused by: javax.net.ssl.SSLException: bad record MAC
    sslContextParameters.setSecureSocketProtocol("SSLv3");

    registry.bind("sslContextParameters", sslContextParameters);
}
项目:Camel    文件:SslContextParametersCometdProducerConsumerTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            KeyStoreParameters ksp = new KeyStoreParameters();
            ksp.setResource("jsse/localhost.ks");
            ksp.setPassword("changeit");

            KeyManagersParameters kmp = new KeyManagersParameters();
            kmp.setKeyPassword("changeit");
            kmp.setKeyStore(ksp);

            TrustManagersParameters tmp = new TrustManagersParameters();
            tmp.setKeyStore(ksp);

            SSLContextParameters sslContextParameters = new SSLContextParameters();
            sslContextParameters.setKeyManagers(kmp);
            sslContextParameters.setTrustManagers(tmp);

            CometdComponent component = (CometdComponent) context.getComponent("cometds");
            component.setSslContextParameters(sslContextParameters);

            from("direct:input").to(uri);

            from(uri).to("mock:test");
        }
    };
}
项目:openex-worker    文件:EmailTrust.java   
public EmailTrust() {
    TrustManagersParameters trustManagers = new TrustManagersParameters();
    trustManagers.setTrustManager(new DummyTrustManager());
    setTrustManagers(trustManagers);
}
项目:Camel    文件:AbstractTrustManagersParametersFactoryBean.java   
@Override
public Class<TrustManagersParameters> getObjectType() {
    return TrustManagersParameters.class;
}