How to secure a file by password
Hi,
I am writing an application which must be to open a file protected by a user password.
What is the best solution to secure a file by password ?
I imagine to copy the secured file (encrypted) into a temporary file not secured and open it. But how to do ?
Thank you in advance.
Re: How to secure a file by password
If you intend to copy the contents of a file to an unencrypted file, then don't encrypt it at all :)
I suggest you use some cryptographic streaming algorithm. I have once implemented a RC4 cipher as a QIODevice but you may use some ready made solutions (such as libcrypt from OpenSSL) that will decipher contents of a file into memory where you can access it, read it and wipe it out from memory when you don't need it anymore.
Re: How to secure a file by password
what class file can be used to encyrpt a file ????????
Re: How to secure a file by password
Re: Set a password for a file
Depends on your specification - do you want to add a password to a file, or encrypt a file to protect the file being opened without the password ?
Re: Set a password for a file
Ya. I want to add password for a file so that it will be opened if the password is correct.
Re: Set a password for a file
As stated before the threads were merged, use the Qt Cryptographic Architecture.
How to use QCA depends on your specifications - the first thing you need is a cipher, and then you need to decide how to encrypt/decrypt the data using your password.
Re: Set a password for a file
You can find an example here: http://quickgit.kde.org/?p=skrooge.g...kgservices.cpp, in function SKGServices::cryptFile.