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 + E) into a new ciphertext 𝖦𝖫𝖢𝖀Sβ€²,Οƒ(Ξ”M + E βˆ’Eβ€²).

Remember that 𝖦𝖫𝖢𝖀S,Οƒ(Ξ”M + E) = (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 + Ei)}i=1l ∈R⟨n,q⟩(k+1)β‹…l

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

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

, which is a list of GLWE encryptions of the secret key S by Sβ€², and the new secret key Sβ€² is a list of kβ€² polynomials, (S0β€²,S1β€²,…,Skβ€²βˆ’1β€²). Then, the GLWE ciphertext’s key can be switched from S β†’Sβ€² as follows:

⟨Summary C-5⟩ GLWE Key Switching

Given 𝖦𝖫𝖢𝖀S,Οƒ(Ξ”M + E) = (A,B),

𝖦𝖫𝖢𝖀Sβ€²,Οƒ(Ξ”M + Eβ€²) = (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) = (Ai,1,Ai,2,…,Ai,l), where

Ai = Ai,1 q Ξ²1 + Ai,2 q Ξ²2 + β‹― + Ai,l q Ξ²l

2.
βŸ¨π–£π–Ύπ–Όπ—ˆπ—†π—‰Ξ²,l(Ai),𝐾𝑆𝐾i⟩
= Ai,1 ⋅𝖦𝖫𝖢𝖀Sβ€²,Οƒ ( q Ξ²1Si + Ei,1) + Ai,2 ⋅𝖦𝖫𝖢𝖀Sβ€²,Οƒ ( q Ξ²2Si + Ei,2) + β‹― + Ai,l ⋅𝖦𝖫𝖢𝖀Sβ€²,Οƒ ( q Ξ²lSi + Ei,l)

β–Ή 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β€²,Οƒ ((Ai,1 q Ξ²1 + Ai,2 q Ξ²2 + β‹― + Ai,l q Ξ²l) β‹…Si + Ei) β–Ή where Ei = βˆ‘ ⁑ j=1lAi,1Ei,j

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

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

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

4.
B is equivalent to a trivial GLWE encryption with Sβ€², where its every A0,A1,…,Akβ€²βˆ’1 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 + Ei))

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

= 𝖦𝖫𝖢𝖀Sβ€²,Οƒ(Ξ”M + Eβ€²) β–Ή where Eβ€² = E βˆ’βˆ‘ ⁑ i=0kβˆ’1Ei

6.
If we explicitly expand the above relation,

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

= (0,0,… ⁑︷kβ€² ,B) βˆ’(A0β€²,A 1β€²,… ⁑,A kβ€²βˆ’1β€²οΈ·kβ€² ,Bβ€²) β–Ή where Bβ€² = βˆ‘ ⁑ i=0kβ€²βˆ’1 Aiβ€²Siβ€²+ βˆ‘ i=0kβˆ’1AiSi + βˆ‘ i=0kβˆ’1Ei

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

The decryption of the above ciphertext gives us:

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

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

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

= B βˆ’βˆ‘ ⁑ i=0kβˆ’1AiSi βˆ’βˆ‘ i=0kβˆ’1Ei

= Ξ”M + E βˆ’βˆ‘ ⁑ i=0kβˆ’1Ei

= Ξ”M + Eβ€² β‰ˆΞ”M + E β–Ή where Eβ€² = E βˆ’βˆ‘ ⁑ i=0kβˆ’1Ei

Strictly speaking, B βˆ’βˆ‘ ⁑ i=0kβˆ’1AiSi = Ξ”M + E + πΎπ‘ž where K is a polynomial representing 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 + Eβ€²) β‰ˆπ–¦π–«π–Άπ–€Sβ€²,Οƒ(Ξ”M + E)

𝖦𝖫𝖢𝖀Sβ€²,Οƒ(Ξ”M + Eβ€²) is an encryption of plaintext Ξ”M with the plaintext scaling factor 1. However, we can re-interpret this ciphertext 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.

β–‘