How can I store the password in my Qt application?

How can I store the password in my Qt application?

Is there a ready-to-use Qt library?

I am currently saving all my app configurations using QSettings .

+3


source to share


4 answers


If you care about security, you shouldn't store your passwords. However, you can use MD5 and HASH for encryption and then put your result in QSettings.

Here is an example output (Hex format) for QSettings;



QString result = QString(QCryptographicHash::hash(("GoGuD"),QCryptographicHash::Md5).toHex());

      

0


source


If you just need to allow a member to be used QCryptographicHash

. Otherwise, for example to create a database connection, you need to encrypt your password.



One possible way is a library SimpleCrypt

. The project has good documents and examples of use.

0


source


Take a look at https://github.com/frankosterfeld/qtkeychain/ . It works on Mac, Windows, Linux and has an example in source code (see Testclient.cpp).

0


source


So, you want to encrypt your password in some way. The problem is that you need a password to decrypt your password: |

What you can do if you are using linux with gnome (like ubuntu) is to use gnome-keyring . Or other keyring service. This way, you unlock your system key when you log in with your master password and keep all saved passwords. At least the apps that support it. Windows / mac may have a built-in keyring that you can use, but I have no experience with that.

-2


source







All Articles