Smack login with md5 hashed password for Openfire

How can I login with MD5 password for openfire?

I am using smack 4.0.4.

I tried registering DIGEST-MD5 but doesn't work

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

      

I am getting this error:

SASLError using PLAIN: not authorized

My code looks like this:

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

      

+3


source to share


1 answer


I have a similar problem, you can check if your password is in md5.

I have created passwords from userid (long type) as:



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

      

or find out that your xmpp server (openfire) IP is configured correctly the way you want to login.

0


source







All Articles