当前位置: 首页>>代码示例>>Java>>正文


Java SSLConfig.getKeystoreLocation方法代码示例

本文整理汇总了Java中org.jivesoftware.openfire.net.SSLConfig.getKeystoreLocation方法的典型用法代码示例。如果您正苦于以下问题:Java SSLConfig.getKeystoreLocation方法的具体用法?Java SSLConfig.getKeystoreLocation怎么用?Java SSLConfig.getKeystoreLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.openfire.net.SSLConfig的用法示例。


在下文中一共展示了SSLConfig.getKeystoreLocation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSSLConnector

import org.jivesoftware.openfire.net.SSLConfig; //导入方法依赖的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

示例2: createSSLConnector

import org.jivesoftware.openfire.net.SSLConfig; //导入方法依赖的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.jivesoftware.openfire.net.SSLConfig.getKeystoreLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。