2014-01-09 66 views
1

我已經配置了帶有CA證書的StartTLS的ejabberd服務器。 下面是配置:連接到StartTLS配置的XMPP服務器中的問題

{5222, ejabberd_c2s, [ 

      {access, c2s}, 
      {shaper, c2s_shaper}, 
        starttls_required, 
        {certfile, "/etc/ejabberd/conf/ejabberd.pem"}, 
        {max_stanza_size, 65536} 
      ]}, 

我的XMPP客戶已在使用的Java庫啪開發。 只有當證書有效時,我才希望我的XMPP客戶端能夠與服務器一起工作。但我無法做到。 下面是我的XMPP客戶端代碼

ConnectionConfiguration config = new ConnectionConfiguration(host, port, serviceName); 
config.setSASLAuthenticationEnabled(true); 
config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled); 
config.setCompressionEnabled(true); 
config.setTruststorePath(trustStorePath); 
config.setTruststorePassword(trustStorePwd); 
config.setExpiredCertificatesCheckEnabled(true); 
config.setNotMatchingDomainCheckEnabled(true); 
config.setVerifyChainEnabled(true); 

即使我提供它成功地實現了連接信任的虛擬證書。

我錯過了什麼嗎?

回答

1

嘗試

config.setVerifyRootCAEnabled(true);