Codota Logo
SslContext
Code IndexAdd Codota to your IDE (free)

How to use
SslContext
in
org.jboss.netty.handler.ssl

Best Java code snippets using org.jboss.netty.handler.ssl.SslContext (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: io.netty/netty

/**
 * Creates a new {@link SslHandler} with advisory peer information.
 *
 * @param peerHost the non-authoritative name of the host
 * @param peerPort the non-authoritative port
 *
 * @return a new {@link SslHandler}
 */
public final SslHandler newHandler(String peerHost, int peerPort) {
  return newHandler(newEngine(peerHost, peerPort));
}
origin: io.netty/netty

/**
 * Creates a new server-side {@link SslContext}.
 *
 * @param certChainFile an X.509 certificate chain file in PEM format
 * @param keyFile a PKCS#8 private key file in PEM format
 * @return a new server-side {@link SslContext}
 */
public static SslContext newServerContext(File certChainFile, File keyFile) throws SSLException {
  return newServerContext(null, null, certChainFile, keyFile, null, null, null, 0, 0);
}
origin: io.netty/netty

/**
 * Creates a new client-side {@link SslContext}.
 *
 * @param provider the {@link SslContext} implementation to use.
 *                 {@code null} to use the current default one.
 *
 * @return a new client-side {@link SslContext}
 */
public static SslContext newClientContext(SslProvider provider) throws SSLException {
  return newClientContext(provider, null, null, null, null, null, 0, 0);
}
origin: org.graylog2/graylog2-shared

  private SslHandler buildSslHandler() throws CertificateException, SSLException {
    final SslContext sslCtx = SslContext.newServerContext(
        tlsCertFile, tlsKeyFile, emptyToNull(configuration.getRestTlsKeyPassword()));
    return sslCtx.newHandler();
  }
});
origin: com.facebook.nifty/nifty-core

public SslHandler createHandler() throws Exception {
  return clientContext.newHandler();
}
origin: com.facebook.nifty/nifty-core

  @Override
  public SslHandler newHandler() {
    SessionAwareSslHandler handler =
        new SessionAwareSslHandler(
            sslContext.newEngine(),
            sslContext.bufferPool(),
            JavaSslServerConfiguration.this);
    handler.setCloseOnSSLException(true);
    return handler;
  }
};
origin: io.netty/netty

  private SslHandler newHandler(SSLEngine engine) {
    SslHandler handler = new SslHandler(engine, bufferPool());
    if (isClient()) {
      handler.setIssueHandshake(true);
    }
    handler.setCloseOnSSLException(true);
    return handler;
  }
}
origin: io.netty/netty

/**
 * Returns {@code true} if and only if this context is for server-side.
 */
public final boolean isServer() {
  return !isClient();
}
origin: io.netty/netty

SslContext(SslBufferPool bufferPool) {
  this.bufferPool = bufferPool == null? newBufferPool() : bufferPool;
}
origin: com.facebook.nifty/nifty-core

  public SslHandler createHandler(SocketAddress address) throws Exception {
    if (!(address instanceof InetSocketAddress)) {
      return createHandler();
    }
    InetSocketAddress netAddress = (InetSocketAddress) address;
    String host = netAddress.getHostString();
    if (host == null) {
      return createHandler();
    }

    return clientContext.newHandler(host, netAddress.getPort());
  }
}
origin: io.netty/netty

/**
 * Creates a new server-side {@link SslContext}.
 *
 * @param provider the {@link SslContext} implementation to use.
 *                 {@code null} to use the current default one.
 * @param certChainFile an X.509 certificate chain file in PEM format
 * @param keyFile a PKCS#8 private key file in PEM format
 * @return a new server-side {@link SslContext}
 */
public static SslContext newServerContext(
    SslProvider provider, File certChainFile, File keyFile) throws SSLException {
  return newServerContext(provider, null, certChainFile, keyFile, null, null, null, 0, 0);
}
origin: io.netty/netty

/**
 * Creates a new {@link SslHandler}.
 *
 * @return a new {@link SslHandler}
 */
public final SslHandler newHandler() {
  return newHandler(newEngine());
}
origin: io.netty/netty

/**
 * Creates a new client-side {@link SslContext}.
 *
 * @return a new client-side {@link SslContext}
 */
public static SslContext newClientContext() throws SSLException {
  return newClientContext(null, null, null, null, null, null, 0, 0);
}
origin: io.netty/netty

/**
 * Creates a new server-side {@link SslContext}.
 *
 * @param certChainFile an X.509 certificate chain file in PEM format
 * @param keyFile a PKCS#8 private key file in PEM format
 * @param keyPassword the password of the {@code keyFile}.
 *                    {@code null} if it's not password-protected.
 * @return a new server-side {@link SslContext}
 */
public static SslContext newServerContext(
    File certChainFile, File keyFile, String keyPassword) throws SSLException {
  return newServerContext(null, null, certChainFile, keyFile, keyPassword, null, null, 0, 0);
}
origin: io.netty/netty

/**
 * Creates a new client-side {@link SslContext}.
 *
 * @param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s
 *                            that verifies the certificates sent from servers.
 *                            {@code null} to use the default.
 *
 * @return a new client-side {@link SslContext}
 */
public static SslContext newClientContext(TrustManagerFactory trustManagerFactory) throws SSLException {
  return newClientContext(null, null, null, trustManagerFactory, null, null, 0, 0);
}
origin: io.netty/netty

/**
 * Creates a new server-side {@link SslContext}.
 *
 * @param provider the {@link SslContext} implementation to use.
 *                 {@code null} to use the current default one.
 * @param certChainFile an X.509 certificate chain file in PEM format
 * @param keyFile a PKCS#8 private key file in PEM format
 * @param keyPassword the password of the {@code keyFile}.
 *                    {@code null} if it's not password-protected.
 * @return a new server-side {@link SslContext}
 */
public static SslContext newServerContext(
    SslProvider provider, File certChainFile, File keyFile, String keyPassword) throws SSLException {
  return newServerContext(provider, null, certChainFile, keyFile, keyPassword, null, null, 0, 0);
}
origin: io.netty/netty

/**
 * Creates a new client-side {@link SslContext}.
 *
 * @param certChainFile an X.509 certificate chain file in PEM format
 *
 * @return a new client-side {@link SslContext}
 */
public static SslContext newClientContext(File certChainFile) throws SSLException {
  return newClientContext(null, null, certChainFile, null, null, null, 0, 0);
}
origin: io.netty/netty

/**
 * Creates a new server-side {@link SslContext}.
 *
 * @param bufPool the buffer pool which will be used by the returned {@link SslContext}.
 *                {@code null} to use the default buffer pool.
 * @param certChainFile an X.509 certificate chain file in PEM format
 * @param keyFile a PKCS#8 private key file in PEM format
 * @param keyPassword the password of the {@code keyFile}.
 *                    {@code null} if it's not password-protected.
 * @param ciphers the cipher suites to enable, in the order of preference.
 *                {@code null} to use the default cipher suites.
 * @param nextProtocols the application layer protocols to accept, in the order of preference.
 *                      {@code null} to disable TLS NPN/ALPN extension.
 * @param sessionCacheSize the size of the cache used for storing SSL session objects.
 *                         {@code 0} to use the default value.
 * @param sessionTimeout the timeout for the cached SSL session objects, in seconds.
 *                       {@code 0} to use the default value.
 * @return a new server-side {@link SslContext}
 */
public static SslContext newServerContext(
    SslBufferPool bufPool,
    File certChainFile, File keyFile, String keyPassword,
    Iterable<String> ciphers, Iterable<String> nextProtocols,
    long sessionCacheSize, long sessionTimeout) throws SSLException {
  return newServerContext(
      null, bufPool, certChainFile, keyFile, keyPassword,
      ciphers, nextProtocols, sessionCacheSize, sessionTimeout);
}
origin: io.netty/netty

/**
 * Creates a new client-side {@link SslContext}.
 *
 * @param provider the {@link SslContext} implementation to use.
 *                 {@code null} to use the current default one.
 * @param certChainFile an X.509 certificate chain file in PEM format.
 *                      {@code null} to use the system default
 *
 * @return a new client-side {@link SslContext}
 */
public static SslContext newClientContext(SslProvider provider, File certChainFile) throws SSLException {
  return newClientContext(provider, null, certChainFile, null, null, null, 0, 0);
}
origin: com.facebook.nifty/nifty-core

protected SslHandlerFactory createSslHandlerFactory() {
  try {
    SslContext sslContext =
        SslContext.newServerContext(
        SslProvider.JDK,
        null,
        certFile,
        keyFile,
        keyPassword,
        ciphers,
        null,
        0,
        0);
    return new SslHandlerFactory() {
      @Override
      public SslHandler newHandler() {
        SessionAwareSslHandler handler =
            new SessionAwareSslHandler(
                sslContext.newEngine(),
                sslContext.bufferPool(),
                JavaSslServerConfiguration.this);
        handler.setCloseOnSSLException(true);
        return handler;
      }
    };
  }
  catch (SSLException e) {
    throw Throwables.propagate(e);
  }
}
org.jboss.netty.handler.sslSslContext

Javadoc

A secure socket protocol implementation which acts as a factory for SSLEngine and SslHandler. Internally, it is implemented via JDK's SSLContext or OpenSSL's SSL_CTX.

Making your server support SSL/TLS

 
// In your  
ChannelPipelineFactory: 
ChannelPipeline p =  
Channels#pipeline(); 
SslContext sslCtx =  
#newServerContext(File,File); 
p.addLast("ssl",  
#newEngine()); 
... 

Making your client support SSL/TLS

 
// In your  
ChannelPipelineFactory: 
ChannelPipeline p =  
Channels#pipeline(); 
SslContext sslCtx =  
#newClientContext(File); 
p.addLast("ssl",  
#newEngine(String,int)); 
... 

Most used methods

  • newHandler
  • newServerContext
    Creates a new server-side SslContext.
  • bufferPool
    Returns the SslBufferPool used by the SSLEngine and SslHandler created by this context.
  • newClientContext
    Creates a new client-side SslContext.
  • newEngine
    Creates a new SSLEngine using advisory peer information.
  • isClient
    Returns the true if and only if this context is for client-side.
  • newBufferPool

Popular in Java

  • Updating database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • onCreateOptionsMenu (Activity)
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now