当前位置: 首页>>代码示例>>Java>>正文


Java SSLFactory类代码示例

本文整理汇总了Java中org.apache.cassandra.security.SSLFactory的典型用法代码示例。如果您正苦于以下问题:Java SSLFactory类的具体用法?Java SSLFactory怎么用?Java SSLFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SSLFactory类属于org.apache.cassandra.security包,在下文中一共展示了SSLFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createConnection

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
public Socket createConnection(InetAddress peer) throws IOException
{
    // Connect to secure port for all peers if ServerEncryptionOptions is configured other than 'none'
    // When 'all', 'dc' and 'rack', server nodes always have SSL port open, and since thin client like sstableloader
    // does not know which node is in which dc/rack, connecting to SSL port is always the option.
    if (encryptionOptions != null && encryptionOptions.internode_encryption != EncryptionOptions.ServerEncryptionOptions.InternodeEncryption.none)
    {
        if (outboundBindAny)
            return SSLFactory.getSocket(encryptionOptions, peer, secureStoragePort);
        else
            return SSLFactory.getSocket(encryptionOptions, peer, secureStoragePort, FBUtilities.getLocalAddress(), 0);
    }
    else
    {
        Socket socket = SocketChannel.open(new InetSocketAddress(peer, storagePort)).socket();
        if (outboundBindAny && !socket.isBound())
            socket.bind(new InetSocketAddress(FBUtilities.getLocalAddress(), 0));
        return socket;
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:21,代码来源:BulkLoadConnectionFactory.java

示例2: newSocket

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
public static Socket newSocket(InetAddress endpoint) throws IOException
{
    // zero means 'bind on any available port.'
    if (isEncryptedChannel(endpoint))
    {
        if (Config.getOutboundBindAny())
            return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort());
        else
            return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort(), FBUtilities.getLocalAddress(), 0);
    }
    else
    {
        Socket socket = SocketChannel.open(new InetSocketAddress(endpoint, DatabaseDescriptor.getStoragePort())).socket();
        if (Config.getOutboundBindAny() && !socket.isBound())
            socket.bind(new InetSocketAddress(FBUtilities.getLocalAddress(), 0));
        return socket;
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:OutboundTcpConnectionPool.java

示例3: buildSSLOptions

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
private static SSLOptions buildSSLOptions(EncryptionOptions.ClientEncryptionOptions clientEncryptionOptions)
{

    if (!clientEncryptionOptions.enabled)
        return null;

    SSLContext sslContext;
    try
    {
        sslContext = SSLFactory.createSSLContext(clientEncryptionOptions, true);
    }
    catch (IOException e)
    {
        throw new RuntimeException("Could not create SSL Context.", e);
    }

    return JdkSSLOptions.builder()
                        .withSSLContext(sslContext)
                        .withCipherSuites(clientEncryptionOptions.cipher_suites)
                        .build();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:22,代码来源:BulkLoader.java

示例4: newSocket

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
@SuppressWarnings("resource")
public static Socket newSocket(InetAddress endpoint) throws IOException
{
    // zero means 'bind on any available port.'
    if (isEncryptedChannel(endpoint))
    {
        if (Config.getOutboundBindAny())
            return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort());
        else
            return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endpoint, DatabaseDescriptor.getSSLStoragePort(), FBUtilities.getLocalAddress(), 0);
    }
    else
    {
        SocketChannel channel = SocketChannel.open();
        if (!Config.getOutboundBindAny())
            channel.bind(new InetSocketAddress(FBUtilities.getLocalAddress(), 0));
        channel.connect(new InetSocketAddress(endpoint, DatabaseDescriptor.getStoragePort()));
        return channel.socket();
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:21,代码来源:OutboundTcpConnectionPool.java

示例5: newSocket

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
public Socket newSocket() throws IOException
{
    // zero means 'bind on any available port.'
    if (isEncryptedChannel())
    {
        if (Config.getOutboundBindAny())
            return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endPoint(), DatabaseDescriptor.getSSLStoragePort());
        else
            return SSLFactory.getSocket(DatabaseDescriptor.getServerEncryptionOptions(), endPoint(), DatabaseDescriptor.getSSLStoragePort(), FBUtilities.getLocalAddress(), 0);
    }
    else
    {
        Socket socket = SocketChannel.open(new InetSocketAddress(endPoint(), DatabaseDescriptor.getStoragePort())).socket();
        if (Config.getOutboundBindAny() && !socket.isBound())
            socket.bind(new InetSocketAddress(FBUtilities.getLocalAddress(), 0));
        return socket;
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:19,代码来源:OutboundTcpConnectionPool.java

示例6: SecureInitializer

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
public SecureInitializer(Server server, EncryptionOptions encryptionOptions)
{
    super(server);
    this.encryptionOptions = encryptionOptions;
    try
    {
        this.sslContext = SSLFactory.createSSLContext(encryptionOptions, encryptionOptions.require_client_auth);
    }
    catch (IOException e)
    {
        throw new RuntimeException("Failed to setup secure pipeline", e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:Server.java

示例7: initChannel

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
protected void initChannel(Channel channel) throws Exception
{
    SSLEngine sslEngine = sslContext.createSSLEngine();
    sslEngine.setUseClientMode(false);
    sslEngine.setEnabledCipherSuites(encryptionOptions.cipher_suites);
    sslEngine.setNeedClientAuth(encryptionOptions.require_client_auth);
    sslEngine.setEnabledProtocols(SSLFactory.ACCEPTED_PROTOCOLS);
    SslHandler sslHandler = new SslHandler(sslEngine);
    super.initChannel(channel);
    channel.pipeline().addFirst("ssl", sslHandler);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:12,代码来源:Server.java

示例8: initChannel

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
protected void initChannel(Channel channel) throws Exception
{
    super.initChannel(channel);
    SSLEngine sslEngine = sslContext.createSSLEngine();
    sslEngine.setUseClientMode(true);
    sslEngine.setEnabledCipherSuites(encryptionOptions.cipher_suites);
    sslEngine.setEnabledProtocols(SSLFactory.ACCEPTED_PROTOCOLS);
    channel.pipeline().addFirst("ssl", new SslHandler(sslEngine));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:10,代码来源:SimpleClient.java

示例9: SecurePipelineFactory

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
public SecurePipelineFactory(Server server, EncryptionOptions encryptionOptions)
{
    super(server);
    this.encryptionOptions = encryptionOptions;
    try
    {
        this.sslContext = SSLFactory.createSSLContext(encryptionOptions, false);
    }
    catch (IOException e)
    {
        throw new RuntimeException("Failed to setup secure pipeline", e);
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:14,代码来源:Server.java

示例10: AbstractSecureIntializer

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
protected AbstractSecureIntializer(Server server, EncryptionOptions encryptionOptions)
{
    super(server);
    this.encryptionOptions = encryptionOptions;
    try
    {
        this.sslContext = SSLFactory.createSSLContext(encryptionOptions, encryptionOptions.require_client_auth);
    }
    catch (IOException e)
    {
        throw new RuntimeException("Failed to setup secure pipeline", e);
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:14,代码来源:Server.java

示例11: createSslHandler

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
protected final SslHandler createSslHandler() {
    SSLEngine sslEngine = sslContext.createSSLEngine();
    sslEngine.setUseClientMode(false);
    String[] suites = SSLFactory.filterCipherSuites(sslEngine.getSupportedCipherSuites(), encryptionOptions.cipher_suites);
    sslEngine.setEnabledCipherSuites(suites);
    sslEngine.setNeedClientAuth(encryptionOptions.require_client_auth);
    sslEngine.setEnabledProtocols(SSLFactory.ACCEPTED_PROTOCOLS);
    return new SslHandler(sslEngine);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:Server.java

示例12: initChannel

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
protected void initChannel(Channel channel) throws Exception
{
    super.initChannel(channel);
    SSLEngine sslEngine = sslContext.createSSLEngine();
    sslEngine.setUseClientMode(true);
    String[] suites = SSLFactory.filterCipherSuites(sslEngine.getSupportedCipherSuites(), encryptionOptions.cipher_suites);
    sslEngine.setEnabledCipherSuites(suites);
    sslEngine.setEnabledProtocols(SSLFactory.ACCEPTED_PROTOCOLS);
    channel.pipeline().addFirst("ssl", new SslHandler(sslEngine));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:11,代码来源:SimpleClient.java

示例13: SecurePipelineFactory

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
public SecurePipelineFactory(Server server, EncryptionOptions encryptionOptions)
{
    super(server);
    this.encryptionOptions = encryptionOptions;
    try
    {
        this.sslContext = SSLFactory.createSSLContext(encryptionOptions, encryptionOptions.require_client_auth);
    }
    catch (IOException e)
    {
        throw new RuntimeException("Failed to setup secure pipeline", e);
    }
}
 
开发者ID:jackliu8722,项目名称:cassandra-1.2.16,代码行数:14,代码来源:Server.java

示例14: getServerSocket

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
private ServerSocket getServerSocket(InetAddress localEp) throws IOException, ConfigurationException
{
    final ServerSocket ss;
    if (DatabaseDescriptor.getEncryptionOptions() != null && DatabaseDescriptor.getEncryptionOptions().internode_encryption == EncryptionOptions.InternodeEncryption.all)
    {
        ss = SSLFactory.getServerSocket(DatabaseDescriptor.getEncryptionOptions(), localEp, DatabaseDescriptor.getStoragePort());
        // setReuseAddress happens in the factory.
        logger_.info("Starting Encrypted Messaging Service on port {}", DatabaseDescriptor.getStoragePort());
    }
    else
    {
        ServerSocketChannel serverChannel = ServerSocketChannel.open();
        ss = serverChannel.socket();
        ss.setReuseAddress(true);
        InetSocketAddress address = new InetSocketAddress(localEp, DatabaseDescriptor.getStoragePort());
        try
        {
            ss.bind(address);
        }
        catch (BindException e)
        {
            if (e.getMessage().contains("in use"))
                throw new ConfigurationException(address + " is in use by another process.  Change listen_address:storage_port in cassandra.yaml to values that do not conflict with other services");
            else if (e.getMessage().contains("Cannot assign requested address"))
                throw new ConfigurationException("Unable to bind to address " + address + ". Set listen_address in cassandra.yaml to an interface you can bind to, e.g., your private IP address on EC2");
            else
                throw e;
        }
        logger_.info("Starting Messaging Service on {}", address);
    }
    return ss;
}
 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:33,代码来源:MessagingService.java

示例15: SecureInitializer

import org.apache.cassandra.security.SSLFactory; //导入依赖的package包/类
public SecureInitializer() throws IOException
{
    this.sslContext = SSLFactory.createSSLContext(encryptionOptions, true);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:SimpleClient.java


注:本文中的org.apache.cassandra.security.SSLFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。