繁体   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