Change webaccess auth file format to accommodate different hashing algorithms #992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request fixes issues raised in previous PR (#980) discussion:
Changes:
To fix that I've changed passwords file to use a different format (backwards compatible).
Each line is now in format
username:passwordHash:userlevel:hashAlgorithm:salt
, where only username and passwordHash is required.Each field explained:
password + salt
usinghashAlgorithm
WebAccessUserLevel
enum inwebaccessauth.h
. Default: super admin (100)md5
,sha1
,sha256
(only sha1 is guaranteed to be available). Default: sha1 (Qt4 and Qt5 withQT_CRYPTOGRAPHICHASH_ONLY_SHA1
defined) or sha256 (Qt5). If unknown hash algorithm is usedsha1
is attemptedThere is new #define in
webaccessauth.cpp
-SALT_LENGTH
: when creating a new user entry HEX string of given length is generated as saltUpon saving (i.e. after adding a new user) QLC+ saves row with all five fields (possibly empty salt)
Possible enhancements:
Additional:
Not tested under Qt4
Tested only under Windows
Example passwords file:
Users (username/password):