Skip to main content

Name Obfuscation

note

Name obfuscation is only performed on the official Excalibur app. It is not performed on the server.

To better improve the privacy of users while using the app, the official Excalibur app performs name obfuscation on the files and folders uploaded to the server.

Why Obfuscation and not Encryption?

Unlike the file data which is encrypted, the names are only obfuscated. This means that the names are only transformed in a way that makes them difficult to read or understand, not completely unreadable.

There are a few reasons why we only obfuscate names and not encrypt them.

  • Less Sensitive Data: We assume that the impact of leaked file names is less severe than leaked file content. Hence, even if the names are deobfuscated, the damage is minimal.
  • More Efficient: Obfuscation is less computationally expensive than encryption, which improves performance.
  • Server-Side Searching: To ensure more-or-less equally performant searching of files on all devices, we need to perform the searching on the server. However, this means that the structure of the name must be maintained even though it is obfuscated, which is not the case with encryption.

These three reasons combined make name obfuscation a suitable alternative to encryption for file names.

How It Works

We use a substitution cipher to substitute every byte with another byte. This allows the relative relationship between characters to be maintained while still making the names unreadable.

The Key

To ensure that the same name always produces the same obfuscated name, we use a key to generate the substitution cipher. This key is a 32-byte string derived from the vault key as follows:

HKDF(vaultKey, NULL, "Name Obfuscation Cipher", 32)

where the HKDF(ikm, salt, info, length) function is defined as

HKDF(ikm, salt, info, length) = HKDF-Expand(HKDF-Extract(ikm, salt), info, length)

and where HKDF-Extract and HKDF-Expand are as defined in RFC5869, Section 2.

The Substitution Cipher

To generate the substitution cipher, we use a random permutation of the bytes 0-255. This permutation is then used to substitute each byte in the name with another byte. The random permutation is generated by randomly shuffling an array of the numbers 0 to 255 inclusive using the Fisher-Yates shuffle algorithm. The random generator is seeded using the aforementioned key.

note

The official implementation of the substitution cipher can be found in the obfuscation.ts file.