The best way to encrypt data.
-
I have a file with a data that has to be encrypted. So I want to read the file content, to encrypt, and write to the file back. What is the right way to do it in Qt?
For example (considering I use a xml file) Visual Studio has a special library to encrypt xml files (xml file has embedded encryption capabilities), it works real good. -
-
@Christian-Ehrlicher said in The best way to encrypt data.:
Qt has no built-in library for this but there is e.g. qca or openssl
I suppose it's good enough. Does it works on files or should I do read-encrypt-write? By the way - where do I store the encryption key (considering the user has an option to change it)?
sorry, I don't quite understand
QCA::PrivateKey seckey = QCA::KeyGenerator().createRSA(1024); if (seckey.isNull()) { std::cout << "Failed to make private RSA key" << std::endl; return 1; } QCA::PublicKey pubkey = seckey.toPublicKey(); // check if the key can encrypt if (!pubkey.canEncrypt()) { std::cout << "Error: this kind of key cannot encrypt" << std::endl; return 1; }
seckey is randomly generated? so is pubkey ?
In case of an embedded application the key is stored on the chip flash - out of unauthorized reach.
In case of OS (Linux) - I wonder how it suppose to be handled?