Salted encryption of filenames?

From a purists point of view, the determinstic (or ECB encryption) of file names isn't ideal.

Does it weaken the cipher - absolutely not - the cipher is good against a known plaintext attack (like all modern ciphers) so if the attacker could guess a few filenames by doing analysis of the crypted names, then they've guessed a few filenames and nothing else.

We could generate a salt and store it with the filename. Other encrypted file systems use a hash of the directory path as the IV for the file name encryption. That works quite well. I decided not to do that with rclone as I wanted files to be moveable in heirarchies without breaking their file names. We could store one salt per directory - that would work.

There have been lots of ideas about how to make crypt more secure and if we go for one of those then I'd probably want to roll them up into something more like an index file per directory which would have

  • full file names (so they don't get truncated)
  • hashes of the plaintext
  • name of the file in the directory

Then each file in the directory could just be stored as a UUID or something like that.

It might be better to allow multiple index files per directory to act as log, which rclone would garbage collect every now and again.

I'd probably want to embed the info within the file too so that rclone could regenerate the indexes if things went wrong.