EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Stopping double encryption

Posted: 03/28/2015 04:09:08
by Manoj Jain (Standard support level)
Joined: 02/28/2013
Posts: 95

C++ Header Encryption Sample

CallBackFilter : Any version

Steps :
1. Start encryption
2. We copy a normal file to the folder.
3. The formal file gets encrypted
4. Stop encryption
5. Selected another folder and start encryption
6. copy file encrypted at stage 3 above to new folder and it will get encrypted again.

I want t avoid C. When we copy a encrypted file in the "selected folder" after starting encryption. It gets encrypted again.

I want that a encryoted file should not encrypted again (with same header)

I added following code in CbFltPostReadFileC

It allows encrypted and non-encrypted file both to be opened properly from the folder. Original code will decrypt all the files and hence normal files will not open if encryption is ON.

  //Context->DecryptBuffer((PBYTE)Buffer, BytesToRead);
         Context->DecryptBuffer((PBYTE)Buffer, BytesToRead);

I want to know how can I stop double encryption . At which stage should I check HeaderPresent .
Posted: 03/28/2015 06:02:24
by Eugene Mayevski (Team)

The problem you are having is more related to the overall design of your application. What you described is technically correct, because the proper approach would be to decrypt the files on-the-fly once they are read from their encrypted location.

This way when the data is read from the source file during copying, it's decrypted. Then, when the data is written to the destination, it's encrypted back.

What you would expect to implement is that the code somehow detects that the file being written (remember, there's no "copy" operation in the system, it's just writing of some data) is encrypted. IF writing is done in one thread, then you can inspect the first block of the file, detect the encryption header and stop encryption for this file. The problem, however, is that Windows Explorer in Windows 8 and later copies files in a multithreaded manner and it's possible that you'll get write requests for the logical block 1 before the write request for the logical block 0). In this situation you won't be able to check the data for the encrypted header.

Sincerely yours
Eugene Mayevski
Posted: 03/28/2015 06:08:53
by Manoj Jain (Standard support level)
Joined: 02/28/2013
Posts: 95

As stated earlier I am using C++ Header Encryption Sample //// NO CHANGE in SAMPLE

In short .... not possible or there is a way
Posted: 03/28/2015 06:13:08
by Eugene Mayevski (Team)

Possible, as I have described, but prone to errors. The solution is to re-think the design.

Sincerely yours
Eugene Mayevski
Posted: 03/28/2015 06:23:34
by Manoj Jain (Standard support level)
Joined: 02/28/2013
Posts: 95

As I am just testing with C++ Header Encryption.

What possibly I can do ..

Should make an application and read the file using fread and find the header and than do copy through this application for this purpose?
Posted: 03/28/2015 07:15:20
by Eugene Mayevski (Team)

Yes, specialized application or a function in your application that will allow the user copy the encrypted files without encrypting/decrypting them is the simplest and the least error-prone way.

Sincerely yours
Eugene Mayevski



Topic viewed 5383 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!