Embedded Jetty with client certificates

前端 未结 1 1385
南方客
南方客 2021-01-16 19:15

I want to create embedded https server that required the clients to present a certificate and I am using this: http://www.smartjava.org/content/embedded-jetty-client-certifi

相关标签:
1条回答
  • 2021-01-16 19:46

    There are numerous examples of Jetty embedded use on github.com/eclipse/jetty.project

    Example: LikeJettyXml.java - Jetty 8, with no XML used, setting up an SSL connector.

        SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
        ssl_connector.setPort(8443);
        SslContextFactory cf = ssl_connector.getSslContextFactory();
        cf.setKeyStorePath(jetty_home + "/etc/keystore");
        cf.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
        cf.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
        cf.setTrustStore(jetty_home + "/etc/keystore");
        cf.setTrustStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
        cf.setExcludeCipherSuites(
                new String[] {
                    "SSL_RSA_WITH_DES_CBC_SHA",
                    "SSL_DHE_RSA_WITH_DES_CBC_SHA",
                    "SSL_DHE_DSS_WITH_DES_CBC_SHA",
                    "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
                    "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
                    "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
                    "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"
                });
        ssl_connector.setStatsOn(false);
        server.addConnector(ssl_connector);
        ssl_connector.open();
    
        SslSocketConnector ssl2_connector = new SslSocketConnector(cf);
        ssl2_connector.setPort(8444);
        ssl2_connector.setStatsOn(false);
        server.addConnector(ssl2_connector);
        ssl2_connector.open();
    
    0 讨论(0)
提交回复
热议问题