Hi jacek,
I have finished with the first version of module.
I have some doubts.
1) My code for encryption and decryption will create two files test.ct and test.ct.enc.
test.ct with alphanumeric characters and test.ct.enc with encrypted data. I delete test.ct so that the user cannot view the original text. I retain test.ct.enc back.
Problems-->
I dont want the user to get confused by renaming the file's extension. What I want is, the same file test.ct to be encrypted and retained.
I have some solutions in my mind but is unsure if it is correct.
First, test.ct contains this data
# file version 2
6 2 1 1 4 4 0 0 0 0.9625 0.0125 0 1
6 2 1 2 3 3 0 0 0 0.4 0 0 1
# file version 2
6 2 1 1 4 4 0 0 0 0.9625 0.0125 0 1
6 2 1 2 3 3 0 0 0 0.4 0 0 1
To copy to clipboard, switch view to plain text mode
My possible solutions-->
Solution1-->
First open the file(test.ct) using a stream. Read the first line. Check if the first line matches '# file version 2'. If yes the file has to be encrypted else decrypt the file.
If yes
Write the encrypted data to a temporary file 'test.ct.enc'. Delete 'test.ct' then rename 'test.ct.enc' to 'test.ct'
Else
Decrypt 'test.ct'. Write original data to temp file 'test.ct.enc'. Read original data from 'test.ct.enc' and delete after processing.
Solution2-->
Take a string 'version2'. Encrypt it with a private password(Known to me and not others). Create a block with encrypted data. Say this is block1.
Encrypt the file contents with the user's password(As done by me now). Say this is block2.
Attach both block1 and block2 in a file. block1 first then block2.
To encrypt or decrypt I enter my private password and check if it is new version.
If yes-->Encrypt
Else
Decrypt...
Here too the same process of creating dummy file exists.
Now according to me the first solution is easy to implement. The second solution is tough as I have to deal with blocks for which I have to be thorough with crypto++. I need to know internally how the classes are written. My deadline is too short to achieve that.
Yesterday I just gave an attempt to get solution2. But found difficult to attach block1 and block2 in a single file.
I'm thorough with filestreams and can produce some efficient code. So dont have problem with solution1.
Now, please help me to achieve some good and best results.
Waiting eagerly
Bookmarks