md.update(password, 0, Math.min(password.length, 127));
md.update(uValue, VALIDATION_SALT_OFFSET, SALT_LENGHT);
hash = md.digest();
isUserPass = compareArray(hash, uValue, 32);
if (!isUserPass)
throw new BadPasswordException(MessageLocalization.getComposedMessage("bad.user.password"));
md.update(password, 0, Math.min(password.length, 127));
md.update(uValue, KEY_SALT_OFFSET, SALT_LENGHT);
hash = md.digest();
AESCipherCBCnoPad ac = new AESCipherCBCnoPad(false, hash);
key = ac.processBlock(ueValue, 0, ueValue.length);
}
AESCipherCBCnoPad ac = new AESCipherCBCnoPad(false, key);
byte[] decPerms = ac.processBlock(perms, 0, perms.length);
if (decPerms[9] != (byte)'a' || decPerms[10] != (byte)'d' || decPerms[11] != (byte)'b')
throw new BadPasswordException(MessageLocalization.getComposedMessage("bad.user.password"));
permissions = (decPerms[0] & 0xff) | ((decPerms[1] & 0xff) << 8)
| ((decPerms[2] & 0xff) << 16) | ((decPerms[2] & 0xff) << 24);
encryptMetadata = decPerms[8] == (byte)'T';
return isOwnerPass;
}