Based on
this post. Suppose you have some system that needs to be protected from hypothetical intruders. Suppose also that attackers can get physical access to data carriers, and, even more annoying, physical access (with the possibility of applying physical measures) directly to you. It is necessary to provide the following conditions:
- Attackers should read access to some data on the disk, but not all data.
- The existence of data to which they do not have access, the attackers should not know. The file system should look solid and free from hidden data.
- Attackers should not be able to modify the data on the disk. Any attempt to change the data should lead to irreversible and easily demonstrable damage to the file system.
I think I know how to do this.
')
First of all, I want to say that everything below and above is only theoretical arguments that do not call for anything except to discuss the potential possibility of creating such a file system.
So, initially we have a disk represented by a set of blocks of a fixed size, the blocks go in a row and can be numbered from 0 to N. Suppose we have a certain function F (i, K) that takes the input block number i and some key K. Function is such that for any 0 <= i <= N its result lies in the range [0..N] and for different i the result will be different. In other words, the function F translates the “logical” block number into the “physical”, depending on the key K. Such a function can be built, for example, by rearranging the bits in i.
First, we generate the key K1 and create the file system on a “mixed” disk using the F disk. We fill it with some data that we will call “open”. Data is encrypted by a specific algorithm (about it below). The key K1 we can safely report to attackers. Domustim, this data occupied a certain set of M [] blocks on the file system.
The next step is to generate the key K2 so that the blocks in M ​​[] correspond to the known set i, say, i = N-Nm ... N, where Nm is the number of blocks in M ​​[]. In the future, we do not use these blocks. This is probably the most non-trivial step, but it can be facilitated if the algorithm for placing files into blocks in a file system is quite simple.
In the remaining space, in blocks i = 0 ... N-Nm-1, we place the private data, the intruders' access to which must be excluded. Data is encrypted.
About encryption algorithm. To ensure that it is impossible to modify data on a file system without destroying it, it is necessary to use asymmetric public key encryption. In this case, the “public key” is used for reading (decrypting data), and the “closed” key - for writing (encryption). The public key used to decrypt “open data” can be communicated to attackers, but they should not be given a private key (this will be difficult, yes, but it is quite possible). The attackers will be able to read the data from the open part of the file system, but will not be able to modify it.
The encryption algorithm of the closed part of the file system should be such that the entropy of the encrypted data is as large as possible. Those. That the ciphered block with data was indistinguishable from simply the block hammered by random numbers. If at the same time the FS when a file is deleted will block the vacated blocks with “garbage”, then the blocks with hidden data will not be any different from just free blocks when using the K1 key.
Thus, in the case of a disk capture by you and intruders, you can safely tell them K1 and the public key to read data from the “open” partition. The presence of some other data on the disk you can safely deny, to prove their presence, not knowing K2 and the second set of encryption keys will be impossible. Also, it will not be possible to modify the data in the "open" section, since you will obviously refuse to inform the attackers of this "secret" key.
I don’t think that I’m the first to come up with a similar idea, so if any reader points to an existing implementation of this, I will be very grateful.