2014-09-11 85 views
3

如何使用MD5散列密码来登录openfire?使用md5 Smack登录散列密码到Openfire

我正在使用smack 4.0.4。

我试过DIGEST-MD5 registiration但它不能正常工作

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

我得到这个错误:

SASLError使用简单:没有授权

我代码如下所示:

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"); 

回答

0

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

我已经生成的用户ID(长型)一个密码为:

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

或发现,当你想登录您的XMPP服务器(Openfire的)IP配置是否正确。