Fix #440 Hash algo's sometimes skipped for old algorithm support

- Fix check that discards potentially trying all encryption methods if password didn't match
- Wrap call to encryption method properly to avoid calling methods with hasSeparateSalt() = true and a null salt
This commit is contained in:
ljacqu
2016-01-14 21:55:09 +01:00
parent 4042ced5f2
commit 391e1b04a2
3 changed files with 29 additions and 11 deletions
@@ -1,7 +1,9 @@
package fr.xephi.authme.security.crypts;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.security.crypts.description.Recommendation;
import fr.xephi.authme.security.crypts.description.Usage;
import fr.xephi.authme.util.StringUtils;
@Recommendation(Usage.DOES_NOT_WORK)
public class WBB4 extends HexSaltedMethod {
@@ -13,7 +15,12 @@ public class WBB4 extends HexSaltedMethod {
@Override
public boolean comparePassword(String password, HashedPassword hashedPassword, String playerName) {
return BCRYPT.checkpw(password, hashedPassword.getHash(), 2);
try {
return BCRYPT.checkpw(password, hashedPassword.getHash(), 2);
} catch (IllegalArgumentException e) {
ConsoleLogger.showError("WBB4 compare password returned: " + StringUtils.formatException(e));
}
return false;
}
@Override