io.netty.handler.ssl.SslContext.newServerContext()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(16.2k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中io.netty.handler.ssl.SslContext.newServerContext()方法的一些代码示例,展示了SslContext.newServerContext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SslContext.newServerContext()方法的具体详情如下:
包路径:io.netty.handler.ssl.SslContext
类名称:SslContext
方法名:newServerContext

SslContext.newServerContext介绍

[英]Creates a new server-side SslContext.
[中]创建新的服务器端SslContext。

代码示例

代码示例来源:origin: redisson/redisson

/**
 * 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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(File certChainFile, File keyFile) throws SSLException {
  return newServerContext(certChainFile, keyFile, null);
}

代码示例来源:origin: redisson/redisson

/**
 * 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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    File certChainFile, File keyFile, String keyPassword) throws SSLException {
  return newServerContext(null, certChainFile, keyFile, keyPassword);
}

代码示例来源:origin: redisson/redisson

/**
 * 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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    SslProvider provider, File certChainFile, File keyFile) throws SSLException {
  return newServerContext(provider, certChainFile, keyFile, null);
}

代码示例来源:origin: redisson/redisson

/**
 * 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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    SslProvider provider, File certChainFile, File keyFile, String keyPassword) throws SSLException {
  return newServerContext(provider, certChainFile, keyFile, keyPassword, null, IdentityCipherSuiteFilter.INSTANCE,
              null, 0, 0);
}

代码示例来源:origin: wildfly/wildfly

/**
 * 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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(File certChainFile, File keyFile) throws SSLException {
  return newServerContext(certChainFile, keyFile, null);
}

代码示例来源:origin: wildfly/wildfly

/**
 * 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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    File certChainFile, File keyFile, String keyPassword) throws SSLException {
  return newServerContext(null, certChainFile, keyFile, keyPassword);
}

代码示例来源:origin: wildfly/wildfly

/**
 * 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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    SslProvider provider, File certChainFile, File keyFile) throws SSLException {
  return newServerContext(provider, certChainFile, keyFile, null);
}

代码示例来源:origin: redisson/redisson

/**
 * 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.
 * @param ciphers the cipher suites to enable, in the order of preference.
 *                {@code null} to use the default cipher suites.
 * @param cipherFilter a filter to apply over the supplied list of ciphers
 * @param apn Provides a means to configure parameters related to application protocol negotiation.
 * @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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    File certChainFile, File keyFile, String keyPassword,
    Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
    long sessionCacheSize, long sessionTimeout) throws SSLException {
  return newServerContext(
      null, certChainFile, keyFile, keyPassword,
      ciphers, cipherFilter, apn, sessionCacheSize, sessionTimeout);
}

代码示例来源:origin: redisson/redisson

/**
 * 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.
 * @param ciphers the cipher suites to enable, in the order of preference.
 *                {@code null} to use the default cipher suites.
 * @param cipherFilter a filter to apply over the supplied list of ciphers
 *                Only required if {@code provider} is {@link SslProvider#JDK}
 * @param apn Provides a means to configure parameters related to application protocol negotiation.
 * @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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(SslProvider provider,
    File certChainFile, File keyFile, String keyPassword,
    Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
    long sessionCacheSize, long sessionTimeout) throws SSLException {
  return newServerContext(provider, null, null, certChainFile, keyFile, keyPassword, null,
      ciphers, cipherFilter, apn, sessionCacheSize, sessionTimeout);
}

代码示例来源:origin: redisson/redisson

/**
 * 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.
 * @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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    File certChainFile, File keyFile, String keyPassword,
    Iterable<String> ciphers, Iterable<String> nextProtocols,
    long sessionCacheSize, long sessionTimeout) throws SSLException {
  return newServerContext(
      null, certChainFile, keyFile, keyPassword,
      ciphers, nextProtocols, sessionCacheSize, sessionTimeout);
}

代码示例来源:origin: wildfly/wildfly

/**
 * 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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    SslProvider provider, File certChainFile, File keyFile, String keyPassword) throws SSLException {
  return newServerContext(provider, certChainFile, keyFile, keyPassword, null, IdentityCipherSuiteFilter.INSTANCE,
              null, 0, 0);
}

代码示例来源:origin: wildfly/wildfly

/**
 * 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.
 * @param ciphers the cipher suites to enable, in the order of preference.
 *                {@code null} to use the default cipher suites.
 * @param cipherFilter a filter to apply over the supplied list of ciphers
 * @param apn Provides a means to configure parameters related to application protocol negotiation.
 * @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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    File certChainFile, File keyFile, String keyPassword,
    Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
    long sessionCacheSize, long sessionTimeout) throws SSLException {
  return newServerContext(
      null, certChainFile, keyFile, keyPassword,
      ciphers, cipherFilter, apn, sessionCacheSize, sessionTimeout);
}

代码示例来源:origin: wildfly/wildfly

/**
 * 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.
 * @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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    File certChainFile, File keyFile, String keyPassword,
    Iterable<String> ciphers, Iterable<String> nextProtocols,
    long sessionCacheSize, long sessionTimeout) throws SSLException {
  return newServerContext(
      null, certChainFile, keyFile, keyPassword,
      ciphers, nextProtocols, sessionCacheSize, sessionTimeout);
}

代码示例来源:origin: wildfly/wildfly

/**
 * 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.
 * @param ciphers the cipher suites to enable, in the order of preference.
 *                {@code null} to use the default cipher suites.
 * @param cipherFilter a filter to apply over the supplied list of ciphers
 *                Only required if {@code provider} is {@link SslProvider#JDK}
 * @param apn Provides a means to configure parameters related to application protocol negotiation.
 * @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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(SslProvider provider,
    File certChainFile, File keyFile, String keyPassword,
    Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
    long sessionCacheSize, long sessionTimeout) throws SSLException {
  return newServerContext(provider, null, null, certChainFile, keyFile, keyPassword, null,
      ciphers, cipherFilter, apn, sessionCacheSize, sessionTimeout);
}

代码示例来源:origin: redisson/redisson

/**
 * 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.
 * @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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    SslProvider provider,
    File certChainFile, File keyFile, String keyPassword,
    Iterable<String> ciphers, Iterable<String> nextProtocols,
    long sessionCacheSize, long sessionTimeout) throws SSLException {
  return newServerContext(provider, certChainFile, keyFile, keyPassword,
              ciphers, IdentityCipherSuiteFilter.INSTANCE,
              toApplicationProtocolConfig(nextProtocols), sessionCacheSize, sessionTimeout);
}

代码示例来源:origin: redisson/redisson

long sessionCacheSize, long sessionTimeout) throws SSLException {
return newServerContext(
    provider, null, trustManagerFactory, certChainFile, keyFile, keyPassword,
    null, ciphers, IdentityCipherSuiteFilter.INSTANCE,

代码示例来源:origin: wildfly/wildfly

/**
 * 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.
 * @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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(
    SslProvider provider,
    File certChainFile, File keyFile, String keyPassword,
    Iterable<String> ciphers, Iterable<String> nextProtocols,
    long sessionCacheSize, long sessionTimeout) throws SSLException {
  return newServerContext(provider, certChainFile, keyFile, keyPassword,
              ciphers, IdentityCipherSuiteFilter.INSTANCE,
              toApplicationProtocolConfig(nextProtocols), sessionCacheSize, sessionTimeout);
}

代码示例来源:origin: wildfly/wildfly

long sessionCacheSize, long sessionTimeout) throws SSLException {
return newServerContext(
    provider, null, trustManagerFactory, certChainFile, keyFile, keyPassword,
    null, ciphers, IdentityCipherSuiteFilter.INSTANCE,

代码示例来源:origin: normanmaurer/netty-in-action

public static void main(String[] args) throws Exception {
    if (args.length != 1) {
      System.err.println("Please give port as argument");
      System.exit(1);
    }
    int port = Integer.parseInt(args[0]);
    SelfSignedCertificate cert = new SelfSignedCertificate();
    SslContext context = SslContext.newServerContext(
        cert.certificate(), cert.privateKey());
    final SecureChatServer endpoint = new SecureChatServer(context);
    ChannelFuture future = endpoint.start(new InetSocketAddress(port));
    Runtime.getRuntime().addShutdownHook(new Thread() {
      @Override
      public void run() {
        endpoint.destroy();
      }
    });
    future.channel().closeFuture().syncUninterruptibly();
  }
}

代码示例来源:origin: io.netty/netty-handler

/**
 * 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}
 * @deprecated Replaced by {@link SslContextBuilder}
 */
@Deprecated
public static SslContext newServerContext(File certChainFile, File keyFile) throws SSLException {
  return newServerContext(certChainFile, keyFile, null);
}

相关文章