5 #ifndef CUTELYSTPLUGIN_CREDENTIALPASSWORD_H
6 #define CUTELYSTPLUGIN_CREDENTIALPASSWORD_H
8 #include <QtCore/QCryptographicHash>
10 #include <Cutelyst/cutelyst_global.h>
11 #include <Cutelyst/Plugins/Authentication/authentication.h>
15 class CredentialPasswordPrivate;
39 QString passwordField()
const;
44 void setPasswordField(
const QString &fieldName);
49 PasswordType passwordType()
const;
54 void setPasswordType(PasswordType type);
59 QString passwordPreSalt()
const;
64 void setPasswordPreSalt(
const QString &passwordPreSalt);
69 QString passwordPostSalt()
const;
74 void setPasswordPostSalt(
const QString &passwordPostSalt);
79 static bool validatePassword(
const QByteArray &password,
const QByteArray &correctHash);
84 static bool validatePassword(
const QString &password,
const QString &correctHash);
96 static QByteArray createPassword(
const QByteArray &password, QCryptographicHash::Algorithm method,
int iterations,
int saltByteSize,
int hashByteSize);
104 static QByteArray createPassword(
const QByteArray &password);
112 inline static QString createPassword(
const QString &password);
123 static QByteArray pbkdf2(QCryptographicHash::Algorithm method,
124 const QByteArray &password,
const QByteArray &salt,
125 int rounds,
int keyLength);
130 static QByteArray hmac(QCryptographicHash::Algorithm method,
const QByteArray &key,
const QByteArray &message);
133 CredentialPasswordPrivate *d_ptr;
static bool validatePassword(const QByteArray &password, const QByteArray &correctHash)
Validates the given password against the correct hash.
static QByteArray createPassword(const QByteArray &password, QCryptographicHash::Algorithm method, int iterations, int saltByteSize, int hashByteSize)
Creates a password hash string.
The Cutelyst namespace holds all public Cutelyst API.
QMultiMap< QString, QString > ParamsMultiMap