LOGGER.fine("MySQLSecurity: Query executed.");
if (results.first())
{
String storedPassword = results.getString(myPassField);
Cipher cipher;
if (encryption.equals(Cipher.CRYPT))
{
String salt = storedPassword.substring(0, 2);
cipher = new Cipher(encryption, salt);
}
else
{
cipher = new Cipher(encryption);
}
String encryptedPassword = cipher.encode(password.trim());
LOGGER.fine("Encrypted Password: " + encryptedPassword);
LOGGER.fine("Stored Password: " + storedPassword);
if (!storedPassword.equals(encryptedPassword))
{
LOGGER.warning("MySQLSecurity: Invalid Username or Password");