C-5 GLWE Key Switching

- Reference: TFHE Deep Dive - Part III - Key switching and leveled multiplicationsΒ [9]

Key switching is a process to change a GLWE ciphertext’s secret key from S to a new key Sβ€² without decrypting the ciphertext. This is equivalent to converting a ciphertext 𝖦𝖫𝖢𝖀S,Οƒ(Ξ”M) into a new ciphertext 𝖦𝖫𝖢𝖀Sβ€²,Οƒ(Ξ”M).

Remember that 𝖦𝖫𝖢𝖀S,Οƒ(Ξ”M) = (A0,A1,Β β‹―Β ,Akβˆ’1,B) ∈R⟨n,q⟩k+1

, where B = βˆ‘ ⁑ i=0kβˆ’1(Ai β‹…Si) + Ξ” β‹…M + E

, and the secret key S is a list of k polynomials: S = (S0,S1,Β β‹―Β Skβˆ’1)

Also, remember that GLev (Β§B-5) is defined as follows:

𝖦𝖫𝖾𝗏S,σβ,l(M) ={GLWES,Οƒ( q Ξ²i β‹…M)}i=1l ∈R⟨n,q⟩(k+1)β‹…l

Now, let’s denote each of the k key-switching keys as follows:

𝐾𝑆𝐾i = 𝖦𝖫𝖾𝗏Sβ€²,σβ,l(Si)
= (𝖦𝖫𝖢𝖀Sβ€²,Οƒ ( q Ξ²1Si) ,𝖦𝖫𝖢𝖀Sβ€²,Οƒ ( q Ξ²2Si) ,Β β‹―Β ,𝖦𝖫𝖢𝖀Sβ€²,Οƒ ( q Ξ²lSi)) ∈R⟨n,q⟩(k+1)β‹…l

, which is a list of GLWE encryptions of the secret key S by Sβ€². Then, the GLWE ciphertext’s key can be switched from S β†’Sβ€² as follows:

⟨Summary C-5⟩ GLWE Key Switching

𝖦𝖫𝖢𝖀Sβ€²,Οƒ(Ξ”M) = (0,0,Β β‹―Β 0οΈ·k,B) βˆ’βˆ‘ ⁑ i=0kβˆ’1Ai β‹…Si

= (0,0,Β β‹―Β 0,B) βˆ’βˆ‘ ⁑ i=0kβˆ’1βŸ¨π–£π–Ύπ–Όπ—ˆπ—†π—‰Ξ²,l(Ai),𝐾𝑆𝐾i⟩

Proof.

1.
Given the principle of polynomial decomposition (Β§A-6.2) and the polynomial Ai ∈ β„€q[x]βˆ•(xn + 1), its decomposition is as follows:

π–£π–Ύπ–Όπ—ˆπ—†π—‰Ξ²,l(Ai) = (A⟨i,1⟩,A⟨i,2⟩,Β β‹―Β A⟨i,l⟩), where

Ai = A⟨i,1⟩ q Ξ²1 + A⟨i,2⟩ q Ξ²2 + β‹― + A⟨i,l⟩ q Ξ²l

2.
βŸ¨π–£π–Ύπ–Όπ—ˆπ—†π—‰Ξ²,l(Ai),𝐾𝑆𝐾i⟩
= A⟨i,1βŸ©β‹…π–¦π–«π–Άπ–€Sβ€²,Οƒ ( q Ξ²1Si) + A⟨i,2βŸ©β‹…π–¦π–«π–Άπ–€Sβ€²,Οƒ ( q Ξ²2Si) + Β β‹―Β  + A⟨i,lβŸ©β‹…π–¦π–«π–Άπ–€Sβ€²,Οƒ ( q Ξ²lSi) # where each GLWE ciphertext is an encryption of Si q Ξ²,Si q Ξ²2,β‹―,Si q Ξ²l as plaintext with the plaintext scaling factor 1

= 𝖦𝖫𝖢𝖀Sβ€²,Οƒ ((A⟨i,1⟩ q Ξ²1 + A⟨i,2⟩ q Ξ²2 + Β β‹―Β A⟨i,l⟩ q Ξ²l) β‹…Si)

= 𝖦𝖫𝖢𝖀Sβ€²,Οƒ ((Ai) β‹…Si) = 𝖦𝖫𝖢𝖀Sβ€²,Οƒ(AiSi)

3.
βˆ‘ ⁑ i=0kβˆ’1βŸ¨π–£π–Ύπ–Όπ—ˆπ—†π—‰Ξ²,l(Ai),𝐾𝑆𝐾i⟩= βˆ‘ i=0kβˆ’1(𝖦𝖫𝖢𝖀Sβ€²,Οƒ(AiSi))

= 𝖦𝖫𝖢𝖀Sβ€²,Οƒ (βˆ‘ ⁑ i=0kβˆ’1AiSi)

4.
B is equivalent to a trivial GLWE encryption with Sβ€², where its every A1,A2,β‹― is 0. That is, 𝖦𝖫𝖢𝖀Sβ€²,Οƒ(B) = (0,0,Β β‹―Β οΈ·k,B). Note that 𝖦𝖫𝖢𝖀Sβ€²,Οƒ(B) can be created without the knowledge of Sβ€², because its all AiSi terms are 0.

5.
𝖦𝖫𝖢𝖀Sβ€²,Οƒ(B) βˆ’π–¦π–«π–Άπ–€Sβ€²,Οƒ (βˆ‘ ⁑ i=0kβˆ’1(AiSi)) = 𝖦𝖫𝖢𝖀Sβ€²,Οƒ(B βˆ’βˆ‘ ⁑ i=0kβˆ’1(AiSi)) = 𝖦𝖫𝖢𝖀Sβ€²,Οƒ(Ξ”M + E)

6.
To expand the above relation,

𝖦𝖫𝖢𝖀Sβ€²,Οƒ(B) βˆ’π–¦π–«π–Άπ–€Sβ€²,Οƒ (βˆ‘ ⁑ i=0kβˆ’1(AiSi))

= (0,0,Β β‹―Β οΈ·k,B) βˆ’(A0β€²,A 1β€²,Β β‹―Β ,A kβ€²οΈ·k,Bβ€²) # where Bβ€² = βˆ‘ ⁑ i=0kβˆ’1Aiβ€²Siβ€²+ βˆ‘ i=0kβˆ’1AiSi + Eβ€²

(βˆ’A0β€²,βˆ’A 1β€²,Β β‹―Β ,βˆ’A kβ€²οΈ·k,Β B βˆ’Bβ€²)

The decryption of the above ciphertext gives us:

𝖦𝖫𝖢𝖀Sβ€²,Οƒβˆ’1(Β (βˆ’A0β€²,βˆ’A 1β€²,Β β‹―Β ,βˆ’A kβ€²οΈ·k,Β B βˆ’Bβ€²)Β )

= B βˆ’Bβ€²βˆ’βˆ‘ ⁑ i=0kβˆ’1 βˆ’Aiβ€²Siβ€²

= B βˆ’βˆ‘ ⁑ i=0kβˆ’1Aiβ€²Siβ€²βˆ’βˆ‘ i=0kβˆ’1AiSi βˆ’Eβ€²+ βˆ‘ i=0kβˆ’1Aiβ€²Siβ€²

= B βˆ’βˆ‘ ⁑ i=0kβˆ’1AiSi βˆ’Eβ€²

= Ξ”M + E βˆ’Eβ€² β‰ˆΞ”M + E

Strictly speaking, B βˆ’βˆ‘ ⁑ i=0kβˆ’1AiSi = Ξ”M + E + πΎπ‘ž where K is a polynomial to represent the wrap-around coefficient values as multiples of q. However, since all the above computations are done in modulo q, the πΎπ‘ž term gets eliminated.

7.
Thus, (0,0,Β β‹―Β ,B) βˆ’βˆ‘ ⁑ i=0kβˆ’1βŸ¨π–£π–Ύπ–Όπ—ˆπ—†π—‰Ξ²,l(Ai),𝐾𝑆𝐾iβŸ©β‰ˆπ–¦π–«π–Άπ–€Sβ€²,Οƒ(Ξ”M)

𝖦𝖫𝖢𝖀Sβ€²,Οƒ(Ξ”M) is an encryption of plaintext Ξ”M with the plaintext scaling factor 1. However, we can theoretically see this as an encryption of plaintext M with the plaintext scaling factor Ξ”. This way, we can recover the ciphertext’s original scaling factor Ξ” without any additional computation.

β–‘