小编Aru*_*lan的帖子

在Play Framework 1.2.7中使用的Netty的SSL处理程序中处理多个证书

我有一个Java密钥库,我为每个客户的子域存储证书.我打算使用服务器别名来区分密钥存储区中的多个客户,如此处所示.Play框架1.2.7使用Netty的SslHandler来支持服务器端的SSL.我尝试实现使用此解决方案的自定义SslHttpServerContextFactory .

import play.Play;

import javax.net.ssl.*;
import java.io.FileInputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.security.KeyStore;
import java.security.Principal;
import java.security.PrivateKey;
import java.security.Security;
import java.security.cert.X509Certificate;
import java.util.Properties;

public class CustomSslHttpServerContextFactory {

  private static final String PROTOCOL = "SSL";
  private static final SSLContext SERVER_CONTEXT;

  static {

    String algorithm = Security.getProperty("ssl.KeyManagerFactory.algorithm");
    if (algorithm == null) {
      algorithm = "SunX509";
    }

    SSLContext serverContext = null;
    KeyStore ks = null;
    try {
      final Properties p = Play.configuration;

      // Try to load it from …
Run Code Online (Sandbox Code Playgroud)

ssl jsse keystore netty playframework-1.x

2
推荐指数
1
解决办法
2233
查看次数

标签 统计

jsse ×1

keystore ×1

netty ×1

playframework-1.x ×1

ssl ×1