AES-FF1 format-preserving encryption
NIST's FF1 mode: encrypts digits or characters into ciphertext of the same format
Overview
Format-preserving encryption (FPE) encrypts data so that the ciphertext has the same format as the plaintext, for example a 16-digit card number to another 16-digit number. FF1, defined in NIST SP 800-38G, is the approved FPE method using AES.
FF1 treats the input as a string of numerals in a chosen radix, such as 10 for decimal digits. It splits the string into two halves and runs a ten-round Feistel network in which each round function computes an AES-CBC-MAC-like PRF over the tweak, the round number and one half, converts the result to a number, and adds it modulo radix^m to the other half. A tweak allows the same key to encrypt different fields independently.
FF1 is based on the FFX scheme by Mihir Bellare, Phillip Rogaway and Terence Spies. NextSSL includes AES-FF1. The related FF3 mode was found to be insecure and FF3-1 has been revised; FF1 remains approved. Callers choose the radix and length. Each field type should use its own tweak, and the domain should be as large as the data allows.
History
2010–2019FFX format-preserving encryption proposed to NIST
FF1 and FF3 published in NIST SP 800-38G
FF3-1 revision drafted after attacks on FF3
Security notes
FF1 is secure only when the domain is large enough; attacks exploit small domains such as short PINs, and NIST has tightened minimum domain-size requirements. FPE is deterministic for a given tweak and provides no integrity.
Typical uses
Variants in NextSSL
1| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| AES-FPE-FF1 aes-fpe-ff1 |
standard | key 16–32 · nonce 0–1024 · block 16 | NIST SP 800-38G | safe |
Frequently asked questions
Which AES-FF1 format-preserving encryption variants does NextSSL include?
NextSSL registers 1 AES-FF1 format-preserving encryption variant: aes-fpe-ff1.