EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Stopping double encryption

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
Posted: 03/28/2015 04:09:08
by Manoj Jain (Standard support level)
Joined: 02/28/2013
Posts: 94

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 (EldoS Corp.)

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: 94

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 (EldoS Corp.)

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: 94

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 (EldoS Corp.)

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
Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.



Topic viewed 2866 times

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


Back to top

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

Got it!