Is there a way to confirm whether or not a file has already been encrypted

0 votes
asked Nov 26, 2019 by PaulVrugt (180 points)

We are using a file access layer that supports encryption. We'd like to start using for the file encryption. However, we are looking for a way to identify whether or not a file has already been encrypted or not. Does the component provide such a functionality? Or is the only method to keep track of this by appending something to the filename?

1 Answer

+1 vote
answered Nov 26, 2019 by Lukas Pokorny (115,370 points)
selected Nov 26, 2019 by PaulVrugt
Best answer

There is no way to determine whether a file has been encrypted by Rebex Security. This is by design – the encrypted file was intended to be indistinguishable from random data.

However, if you wish to identify encrypted files, you can easily just insert a custom wrapper stream in between the base FileStream and the XtsStream that adds a fixed-length header to the beginning of the file and translates the positions and offsets in Seek method and Position property accordingly.

So instead of XtsStream on top of FileStream (like here), you would have XtsStream on top of CustomHeaderStream on top of FileStream.

commented Nov 26, 2019 by PaulVrugt (180 points)
Thanks,I tested it and it works. It took me a while to find an error I made causing it not to work, but I got it to work in the end.