# Format preserving encryption FFX

In FFX mode the format of the ciphertext is same as plaintext. How does it ensure data integrity and authentication? Is there any bit flip attack in FFX mode? Is it malleable?

• It doesn't ensure data integrity. $\:$ It doesn't ensure authentication. $\;\;\;\;$ – user991 May 2 '15 at 8:40
• Just in case somebody gets confused: if a cipher doesn't have integrity and authentication then it doesn't automatically mean that the cipher is malleable. – Maarten - reinstate Monica May 4 '15 at 0:09

## 1 Answer

FFX is not malleable. It's a strong tweakable pseudo-random permutation, where the "strong" here indicates that both encryption and decryption look like random permutations from the attacker's perspective. In particular, there's no relationship between the plaintexts of closely related ciphertexts (aside from the trivial observation that different ciphertexts give different plaintexts).

FFX can provide integrity protection in very limited circumstances. If most plaintexts aren't valid, then you can detect tampering by ensuring that the plaintext is valid upon decryption. (This is not true for encryption in general --- it's another feature of algorithms with strong tweakable pseudo-random permutation security.) For example, if the plaintext contains a checksum, as with a credit card number, then validating the checksum provides some degree of integrity. However, in most cases this isn't a very strong check; a single-digit checksum will allow one in ten forgery attempts to succeed. (See "Encode-then-encipher encryption" by Bellare and Rogaway as well as the RAE definition in "Robust Authenticated Encryption: AEZ and the Problem it Solves" by Hoang, Krovetz, and Rogaway.)

• I presume TPRP stands for Tweakable Pseudo Random Permutation here? – Maarten - reinstate Monica May 3 '15 at 23:54
• @MaartenBodewes Yes. I edited my answer to expand the acronym out. – Seth May 3 '15 at 23:58
• Question: if most plaintext aren't valid, couldn't you save up bits and add an authentication tag? If there are enough bits available you could even forgo FPE completely. Is there any calculation that can be performed in this regard? Happy to post this as a separate question is this is too complex here... – Maarten - reinstate Monica May 4 '15 at 0:02
• @MaartenBodewes : $\;\;\;$ There would need to be a suitable bijection such that [it and its inverse $\hspace{.62 in}$ can both be efficiently calculated] for that to work. $\:$ I'm pretty sure that that can't always be done. $\hspace{.5 in}$ – user991 May 4 '15 at 1:53