gpt4 book ai didi

java - 使用 md5 哈希密码 Smack 登录 Openfire

转载 作者:行者123 更新时间:2023-12-02 09:21:13 26 4
gpt4 key购买 nike

如何使用 MD5 哈希密码登录 openfire?

我使用的是 smack 4.0.4。

我尝试过 DIGEST-MD5 注册,但不起作用

SASLAuthentication.registerSASLMechanism("DIGEST-MD5", SASLDigestMD5Mechanism.class); 
SASLAuthentication.supportSASLMechanism("DIGEST-MD5");

我收到此错误:

SASLError using PLAIN: not-authorized

我的代码如下所示:

config = new ConnectionConfiguration(xmppServerAddress, Integer.parseInt(xmppServerPort));
config.setDebuggerEnabled(true);
config.setReconnectionAllowed(true);
config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
XMPPTCPConnection connectionTmp = new XMPPTCPConnection(config);
connectionTmp.connect();

connectionTmp.login("username","md5hashedpassword");

最佳答案

我也有类似的问题,你可以检查一下你的密码是否是md5的。

我已从用户 ID(长类型)生成密码:

@Override
public String generatePassword(long userId) {
String userIdString = String.valueOf(userId);
return MD5util.getMD5(userIdString + StringUtil.getStringAlternateCharacters(userIdString));
}

或者查明您的 xmpp 服务器 (openfire) IP 是否已按照您希望的登录方式正确配置。

关于java - 使用 md5 哈希密码 Smack 登录 Openfire,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25785543/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com