Skip to content

Tokens which cannot be decrypted

Sometimes a backup holds a token's details (issuer, label, ...) but its secret can't be decrypted. For example, the encrypted secret may be missing, or it may have been encrypted with a different master key. These tokens are never skipped silently. They are listed in the undecryptable_tokens section of the output, with:

  • uuid (the token ID), name, issuer, label and type, so you can identify the account
  • reason: why the token could not be decrypted
  • related_entries: other backup entries mentioning the token ID, which helps to diagnose unusual backups
  • metadata: the token details stored in the backup

All other tokens are still exported. A warning on stderr tells you how many tokens are affected.

Missing secrets

The most common reason is "no encrypted secret entry found". FreeOTP only adds a token's secret to its backup if it can access its backup master key in the Android Keystore when the token is added; otherwise it silently skips the token. Editing the token later stores only its details. This affects tokens added after restoring a backup with FreeOTP 2.0.2 to 2.0.4 (these versions did not put the master key back into the keystore), or after moving to a new device. The secrets of these tokens are not in the backup and cannot be recovered from it, not even by restoring the backup in the app. Re-enroll these accounts with their services.

Note that a token added under these conditions and never edited leaves no trace in the backup at all, so it cannot be reported. Compare the number of tokens shown in the app with the token_count of the report to find such cases.

Checking a backup

To only check a backup, without writing out any secrets, use --check:

freeotp-export-reader --check freeotp-backup.xml

The report contains the token counts, undecryptable_tokens and unrecognized_entries, which lists backup entries not belonging to any token by name, type and JSON field names only, never their values. Exit codes:

Exit code Meaning
0 All tokens can be decrypted
1 Error, e.g. wrong password or invalid backup file
3 --check found tokens which cannot be decrypted