Index: sources/utility/encryption.cpp =================================================================== diff -u -r76680860f735250b4557eb18fe7422a26c406f23 -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/utility/encryption.cpp (.../encryption.cpp) (revision 76680860f735250b4557eb18fe7422a26c406f23) +++ sources/utility/encryption.cpp (.../encryption.cpp) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,3 +1,17 @@ +/*! + * + * Copyright (c) 2023-2024 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file encryption.cpp + * \author (last) Behrouz NematiPour + * \date (last) 30-Aug-2023 + * \author (original) Behrouz NematiPour + * \date (original) 18-Jul-2023 + * + */ #include "encryption.h" // Linux @@ -54,7 +68,7 @@ * \return encrypted string */ QString encryption::hashedString(const QString &vString, bool &ok, bool vAddMoreSalt) { - int iter = 1000; + int iter = 10000; // https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#pbkdf2 int len = 16; ok = vAddMoreSalt ? ! __salt__.isEmpty() : true; @@ -109,7 +123,7 @@ /*! * \brief encryption::defaultPassword * \details The default password which will be used as an indication that the service password has not been set yet. - * \return the default password as encrypted string. + * \return the default password will be saved as hashed string. */ QString encryption::defaultServicePassword(bool &ok) { @@ -121,3 +135,36 @@ //DEBUG qDebug() << __FUNCTION__ << hashed; return hashed; } + +/*! + * \brief encryption::configurationsPassword + * \details The password which will be used for encrypt partition. + * \return the password will be saved as hashed string. + */ +QString encryption::configurationsPassword(bool &ok, bool vReset) +{ + if ( vReset ) { // "Diality.2023" + const char d [ ] = { 68, 105, 97, 108, 105, 116, 121, 46, 50, 48, 50, 51, 0 }; + return QString(d); + } + const char c [ ] = { + 50, 75, 102, 98, 106, 67, 46, + 68, 89, 115, 116, 109, 46, + 71, 50, 75, 106, 90, 46, + 105, 78, 105, 120, 73, 46, + 78, 105, 51, 50, 89, 46, + 84, 89, 112, 57, 117, 46, + 77, 50, 52, 119, 103, 46, + 50, 89, 98, 98, 106, 46, + 78, 105, 48, 73, 78, 46, + 109, 70, 50, 52, 119, 46, + 103, 50, 76, 76, 90, 46, + 104, 116, 117, 77, 73, 46, + 78, 105, 111, 50, 89, 46, + 84, 89, 112, 57, 117, 46, + 77, 50, 52, 119, + 0 }; + QString hashed = hashedString(QString(c), ok, true); + //DEBUG qDebug() << __FUNCTION__ << hashed << ok; + return hashed; +}