Format-Preserving Encryption
Format-Preserving Encryption
Issues:
Can’t be used for small
domains (Codebook attack)
Changing the key is costly.
FPE: Encryption scheme where the input and the output have the
same format.
Applications
Credit card encryption, SSN encryption, ...
Database Encryption
Data capturing devises used to capture data of specific format (PIN
pads, used with ATM machines).
Product
First product of Voltage Security Inc. (Now Microfocus Inc.)
Standardization
Draft NIST SP 800-38G (March 2016), updated in 2017.
Requirements
Any (user defined) format should be supported.
Ciphertext length expansion is not permitted.
PRP is an overkill.
Attacks against PRP may not be a threat in practice for an FPE
scheme.
L R
Suggestions:
For message domain > 40 bits, use at least 6 rounds (considering
Patarin’s attack).
For message domain ∈ {32, 40} bits, use extra rounds (not efficient
for most of practical FPE applications).
Algorithm 1: FF1N,T
K (X)
1 (a, b) ← N ; X0 ← X
2 for i = 1, 2, . . . , r(N ) do
3 Ai−1 ← Xi−1 div b
4 Bi−1 ← Xi−1 mod b
5 Ci ← (Ai−1 + FK (N, T, i, Bi−1 ))
mod a
6 Xi ← aBi−1 + Ci
7 ret Xr(N )
Algorithm 2: FF2N,T
K (X)
1 (a, b) ← N
2 Ai−1 ← Xi−1 div b ; Bi−1 ← Xi−1
mod b
3 for i = 1, 2, . . . , r(N ) do
4 if i mod 2=1 then s ← a else
s←b
5 Ai ← Bi−1
6 Bi ← (Ai−1 + FK (N, T, i, Bi−1 ))
mod s
7 ret sAr(N ) + Br(N )
As per designer’s claim, both FEA-1 and FEA-2 are almost two
times faster than FF1 and FF3.
SPFN
r , a member of SPF family consist r-rounds and works for the
alphabet set Σ, where |Σ| = N .
The motivating applications of FPE are CCN and SSN, i.e, string of
digits.
x 0 1 2 3 4 5 6 7 8 9
S[x] 2 6 8 7 1 4 9 5 3 0
Lemma 1
Let M = (mi,j ) be a d × d MDS matrix over a field F2b . Let S be a set
of v elements such that S = {0, 1, . . . , v − 1}; and S ∗ = S − {0}.
Further, let S be a subset of F2b such that {0, 1} ⊂ S and ∀X ∈ S d ,
Y = M × X T ∈ S d . Then :
1 mi,j ∈ S ∗ , ∀ 0 ≤ i, j ≤ d,
2 S ∗ = mi,j S ∗ , ∀ 0 ≤ i, j ≤ d,
3 For any i, j ∈ {0, . . . , d − 1}, the cyclic group generated by mi,j
with respect to multiplication is subset of S ∗ , i.e., hmi,j i ⊆ S ∗ ,
4 S is an additive subgroup of F2b .
SubBytes (SB).
– A bijective mapping S : Fpb → Fpb .
ShiftRows (SR).
– Rotates symbols of the rows cyclically.
MixColumns (MC).
– A MDS matrix defined over Fpb such that N ≤ pb .
Key Addition (KA).
– Symbol wise modular addition of round-key and the current
state.
Tweak Addition (TA).
– Symbol wise modular addition of round tweak and the current
state.
In the following table, we are mentioning the candidate Galois Field for
formats of different sizes with discarding details.
x 0 1 2 3 4 5 6 7 8 9 10
S[x] 2 0 10 6 3 8 9 4 7 5 1
For other format sizes, performance would be very similar, till the
lookup-tables can be kept in the L1 cache.
Hardware implementation of eSPF is almost 10 times faster than
the software implementations considering the clock frequency.
L Ti Ki R
F P RF/P RP F0 ⊕
L0 R0
For a PRF:
Given a non-zero difference ∆, we can get a zero output difference.
1 2−n
(0|∆) →
− (∆|0) −−→ (0|∆)
Thus the probability of seeing this output when using an FFX like
scheme with 2r rounds is 2−2n + 2−rn .
1 2−n
(0|∆) →
− (∆|0) −−→ (0|∆)
Complexity
Algorithm Rounds Block size Keysize Time Data
FEA1 12 8 128 236 232
FEA1 14 8 192 244 240
FEA1 16 8 256 252 248
FEA2 18 8 128 260 256
FEA2 21 8 192 272 268
FEA2 24 8 256 284 280
FF1 10 20 128 270 260
FF3-1 8 40 128 2100 280
Generic 2r 2n - 22n(r−1.5) 22n(r−1.5)−n
Table 8: Comparison of distinguishing attacks.
FF1 and FF3-1 use AES as the round function, and hence key
recovery attack is not possible.