Skip to content
Unicode Trust on First Use (TOFU)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Makefile
README.md
utofu.c

README.md

Unicode TOFU

Check unicode strings to detect changes over time that might be spoofing.

# save string to history
echo "hi" | ./utofu my-history

# attempting to save this one causes a problem
echo "" | ./utofu my-history
FAILURE: string is confusable with previous value
Previous: hi
Current :

The concept is similar to how you trust SSH key fingerprints the first time they are used. If the fingerprint ever changes, SSH fails. With utofu you trust strings and save them in a single-file database. Attempting to save a new string which is confusable with one already in the database causes an error.

How does it work?

The program relies on libicu's Unicode security and spoofing detection. For each line from standard input, the program executes these steps:

  1. Read line as UTF-8
  2. Convert to Normalization Form C for consistency
  3. Calculate skeleton string (confusable strings have the same skeleton)
  4. Insert UTF-8 version of normalized input and its skeleton into the database if the skeleton doesn't already exist
  5. Compare the normalized input string with the string in the database with corresponding skeleton. If not an exact match die with an error.
You can’t perform that action at this time.