簡體   English   中英

連接到已配置StartTLS的XMPP服務器的問題

[英]Issue in connecting to StartTLS configured XMPP Server

我已經為帶有CA證書的StartTLS配置了ejabberd服務器。 下面是配置:

{5222, ejabberd_c2s, [

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

我的XMPP客戶端是使用Smack庫在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);

即使我在信任庫中提供了虛擬證書,它也可以成功建立連接。

我錯過了什么嗎?

嘗試

config.setVerifyRootCAEnabled(true);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM