• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SslContextFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: excludeCipherSuites

import org.eclipse.jetty.http.ssl.SslContextFactory; //导入依赖的package包/类
/**
 * <p>excludeCipherSuites</p>
 * @param contextFactory 
 * @param https_port 
 * @param sslConnector a {@link org.eclipse.jetty.server.security.SslSocketConnector} object.
 */
protected void excludeCipherSuites(SslContextFactory contextFactory, Integer port) {
    String[] defaultExclSuites = {
            "SSL_DHE_DSS_WITH_DES_CBC_SHA",
            "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
            "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
            "SSL_DHE_RSA_WITH_DES_CBC_SHA",
            "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
            "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
            "SSL_RSA_WITH_3DES_EDE_CBC_SHA",
            "SSL_RSA_WITH_DES_CBC_SHA",
            "TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
            "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA",
            "TLS_RSA_WITH_DES_CBC_SHA"
    };
    
    String[] exclSuites;
    String exclSuitesString = System.getProperty("org.opennms.netmgt.jetty.https-exclude-cipher-suites");
    if (exclSuitesString == null) {
        log().warn("No excluded SSL/TLS cipher suites specified, using hard-coded defaults");
        exclSuites = defaultExclSuites;
    } else {
        exclSuites = exclSuitesString.split("\\s*:\\s*");
        log().warn("Excluding " + exclSuites.length + " user-specified SSL/TLS cipher suites");
    }
    
    contextFactory.setExcludeCipherSuites(exclSuites);
    
    for (String suite : exclSuites) {
        log().info("Excluded SSL/TLS cipher suite " + suite + " for connector on port " + port);
    }
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:38,代码来源:JettyServer.java


示例2: createSSLConnector

import org.eclipse.jetty.http.ssl.SslContextFactory; //导入依赖的package包/类
private void createSSLConnector(int securePort) {
    httpsConnector = null;
    try {
        if (securePort > 0 && CertificateManager.isRSACertificate(SSLConfig.getKeyStore(), "*")) {
            if (!CertificateManager.isRSACertificate(SSLConfig.getKeyStore(),
                    XMPPServer.getInstance().getServerInfo().getXMPPDomain())) {
                Log.warn("HTTP binding: Using RSA certificates but they are not valid for " +
                        "the hosted domain");
            }

            final SslContextFactory sslContextFactory = new SslContextFactory(SSLConfig.getKeystoreLocation());
            sslContextFactory.setTrustStorePassword(SSLConfig.getc2sTrustPassword());
            sslContextFactory.setTrustStoreType(SSLConfig.getStoreType());
            sslContextFactory.setTrustStore(SSLConfig.getc2sTruststoreLocation());
            sslContextFactory.setKeyStorePassword(SSLConfig.getKeyPassword());
            sslContextFactory.setKeyStoreType(SSLConfig.getStoreType());

            // Set policy for checking client certificates
            String certPol = JiveGlobals.getProperty("xmpp.client.cert.policy", "disabled");
            if(certPol.equals("needed")) {                    
            	sslContextFactory.setNeedClientAuth(true);
            	sslContextFactory.setWantClientAuth(true);
            } else if(certPol.equals("wanted")) {
            	sslContextFactory.setNeedClientAuth(false);
            	sslContextFactory.setWantClientAuth(true);
            } else {
            	sslContextFactory.setNeedClientAuth(false);
            	sslContextFactory.setWantClientAuth(false);
            }
            
            final SslSelectChannelConnector sslConnector = new SslSelectChannelConnector(sslContextFactory);
            sslConnector.setHost(getBindInterface());
            sslConnector.setPort(securePort);
            configureProxiedConnector(sslConnector);
            httpsConnector = sslConnector;
        }
    }
    catch (Exception e) {
        Log.error("Error creating SSL connector for Http bind", e);
    }
}
 
开发者ID:idwanglu2010,项目名称:openfire,代码行数:42,代码来源:HttpBindManager.java


示例3: main

import org.eclipse.jetty.http.ssl.SslContextFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    int timeout = (int) Duration.ONE_HOUR.getMilliseconds();

    Server server = new Server();
    SocketConnector connector = new SocketConnector();

    // Set some timeout options to make debugging easier.
    connector.setMaxIdleTime(timeout);
    connector.setSoLingerTime(-1);
    connector.setPort(8081);
    server.addConnector(connector);

    // check if a keystore for a SSL certificate is available, and
    // if so, start a SSL connector on port 8443. By default, the
    // quickstart comes with a Apache Wicket Quickstart Certificate
    // that expires about half way september 2021. Do not use this
    // certificate anywhere important as the passwords are available
    // in the source.

    Resource keystore = Resource.newClassPathResource("/keystore");
    if (keystore != null && keystore.exists()) {
        connector.setConfidentialPort(8443);

        SslContextFactory factory = new SslContextFactory();
        factory.setKeyStoreResource(keystore);
        factory.setKeyStorePassword("wicket");
        factory.setTrustStoreResource(keystore);
        factory.setKeyManagerPassword("wicket");
        SslSocketConnector sslConnector = new SslSocketConnector(factory);
        sslConnector.setMaxIdleTime(timeout);
        sslConnector.setPort(8443);
        sslConnector.setAcceptors(4);
        server.addConnector(sslConnector);

        System.out.println("SSL access to the quickstart has been enabled on port 8443");
        System.out.println("You can access the application using SSL on https://localhost:8443");
        System.out.println();
    }

    WebAppContext bb = new WebAppContext();
    bb.setServer(server);
    bb.setContextPath("/");
    bb.setWar("src/test/webapp");

    // START JMX SERVER
    // MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
    // MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer);
    // server.getContainer().addEventListener(mBeanContainer);
    // mBeanContainer.start();

    server.setHandler(bb);
    
    //TOGGLE between these two method to experiment different reloading strategies
    // Autoreload builds and reload the classes automatically
    setAutoReloadProperties();
    // WatchClasses watch the target dir for reloading (build with your IDE or maven)
    //setWatchClassesProperties();
    try {
        System.out.println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");
        server.start();
        System.in.read();
        System.out.println(">>> STOPPING EMBEDDED JETTY SERVER");
        server.stop();
        server.join();
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(1);
    }
}
 
开发者ID:code-troopers,项目名称:wicket-hot-reload,代码行数:70,代码来源:Start.java


示例4: createSSLConnector

import org.eclipse.jetty.http.ssl.SslContextFactory; //导入依赖的package包/类
private void createSSLConnector(int securePort) {
    httpsConnector = null;
    try {
        if (securePort > 0 && CertificateManager.isRSACertificate(SSLConfig.getKeyStore(), "*")) {
            if (!CertificateManager.isRSACertificate(SSLConfig.getKeyStore(),
                    XMPPServer.getInstance().getServerInfo().getXMPPDomain())) {
                Log.warn("HTTP binding: Using RSA certificates but they are not valid for " +
                        "the hosted domain");
            }

            final SslContextFactory sslContextFactory = new SslContextFactory(SSLConfig.getKeystoreLocation());
            sslContextFactory.setTrustStorePassword(SSLConfig.getc2sTrustPassword());
            sslContextFactory.setTrustStoreType(SSLConfig.getStoreType());
            sslContextFactory.setTrustStore(SSLConfig.getc2sTruststoreLocation());
            sslContextFactory.setKeyStorePassword(SSLConfig.getKeyPassword());
            sslContextFactory.setKeyStoreType(SSLConfig.getStoreType());

            // Set policy for checking client certificates
            String certPol = JiveGlobals.getProperty("xmpp.client.cert.policy", "disabled");
            if(certPol.equals("needed")) {                    
            	sslContextFactory.setNeedClientAuth(true);
            	sslContextFactory.setWantClientAuth(true);
            } else if(certPol.equals("wanted")) {
            	sslContextFactory.setNeedClientAuth(false);
            	sslContextFactory.setWantClientAuth(true);
            } else {
            	sslContextFactory.setNeedClientAuth(false);
            	sslContextFactory.setWantClientAuth(false);
            }
            
            final SslSelectChannelConnector sslConnector = new SslSelectChannelConnector(sslContextFactory);
            sslConnector.setHost(getBindInterface());
            sslConnector.setPort(securePort);
            
            httpsConnector = sslConnector;
        }
    }
    catch (Exception e) {
        Log.error("Error creating SSL connector for Http bind", e);
    }
}
 
开发者ID:surevine,项目名称:openfire-bespoke,代码行数:42,代码来源:HttpBindManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LazyDynaBean类代码示例发布时间:2022-05-23
下一篇:
Java ReceiverSettleMode类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap