密钥封装机制 (Key Encryption Mechanism, KEM) .
密钥生成 KEM.Gen . ( p k , s k ) ← Gen ( 1 κ ) (pk,sk)\leftarrow \text{Gen}(1^\kappa) ( p k , s k ) ← Gen ( 1 κ ) 得到公私钥对;密钥封装 KEM.Encap . ( K , ψ ) ← Encap ( p k ) (K,\psi)\leftarrow \text{Encap}(pk) ( K , ψ ) ← Encap ( p k ) 通过公钥封装成一个 key K K K 与密文/封装 ψ \psi ψ ;密钥解封装 KEM.Decap . K ′ ← Decap ( s k , ψ ) K'\leftarrow\text{Decap}(sk,\psi) K ′ ← Decap ( s k , ψ ) 通过私钥解封装得到 key K K K 。目的 :双方在公开信道上交换共享密钥 K K K ,于是可以用交换的密钥进行对称加密通信。
正确性 :∀ κ , ∀ ( p k , s k ) ← Gen ( 1 κ ) , ∀ ( K , ψ ) ← Encap ( p k ) , Decap ( s k , ψ ) = K \forall \kappa,\forall (pk,sk)\leftarrow \text{Gen}(1^\kappa),\forall (K,\psi)\leftarrow\text{Encap}(pk), \text{Decap}(sk,\psi)=K ∀ κ , ∀ ( p k , s k ) ← Gen ( 1 κ ) , ∀ ( K , ψ ) ← Encap ( p k ) , Decap ( s k , ψ ) = K .
💡
KEM 的 CPA 安全性 :敌手根据所有公开信息
( p k , ψ ) (pk, \psi) ( p k , ψ ) 计算的密钥与随机数不可区分。
Adv KEM , A CPA ( κ ) = ∣ Pr [ Exp KEM , A CPA-1 ( κ ) = 1 ] − Pr [ Exp KEM , A CPA-0 ( κ ) = 1 ] ∣ = negl ( κ ) \begin{aligned}\textbf{Adv}_{\text{KEM},\mathcal{A}}^\text{CPA}(\kappa)=\left|\text{Pr}[\textbf{Exp}_{\text{KEM},\mathcal{A}}^\text{CPA-1}(\kappa)=1]-\text{Pr}[\textbf{Exp}_{\text{KEM},\mathcal{A}}^\text{CPA-0}(\kappa)=1]\right| = \text{negl}(\kappa)\end{aligned} Adv KEM , A CPA ( κ ) = ∣ ∣ Pr [ Exp KEM , A CPA-1 ( κ ) = 1 ] − Pr [ Exp KEM , A CPA-0 ( κ ) = 1 ] ∣ ∣ = negl ( κ ) 其中,0 实验发送均匀随机密钥给敌手,1 实验发送封装内部的密钥给敌手。敌手的目标:根据 p k , ψ pk,\psi p k , ψ 判断提供的密钥 K K K 是随机数(0)还是用于封装的密钥(1)。
C A ( p k , s k ) ← Gen ( 1 κ ) ⟶ p k K 0 ∗ ← K b ← { 0 , 1 } ( K 1 ∗ , ψ ∗ ) ← Encap ( p k ) K ∗ : = K b ∗ ⟶ K ∗ , ψ ∗ return b ′ ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk) \leftarrow\text{Gen}(1^\kappa) &\stackrel{pk}{\longrightarrow} \\K_0^*\leftarrow\mathcal{K}\\b\leftarrow\{0,1\}\\(K_1^*,\psi^*)\leftarrow\text{Encap}(pk) \\K^*:=K_b^*& \stackrel{K^*,\psi^*}{\longrightarrow}\\\text{return }b'& \stackrel{b'}{\longleftarrow}& \text{compute } b'\end{matrix} C ( p k , s k ) ← Gen ( 1 κ ) K 0 ∗ ← K b ← { 0 , 1 } ( K 1 ∗ , ψ ∗ ) ← Encap ( p k ) K ∗ := K b ∗ return b ′ ⟶ p k ⟶ K ∗ , ψ ∗ ⟵ b ′ A compute b ′ b = 0 b=0 b = 0 即为 0 实验,b = 1 b=1 b = 1 即为 1 实验。
通过 PKE 构造 KEM .
KEM.Kg . ( p k , s k ) ← Gen ( 1 κ ) (pk,sk)\leftarrow \text{Gen}(1^\kappa) ( p k , s k ) ← Gen ( 1 κ ) ,返回 ( p k , s k ) (pk,sk) ( p k , s k ) ;KEM.Encap . K ← K , ψ ← Enc ( p k , K ) K \leftarrow \mathcal{K},\psi \leftarrow \text{Enc}(pk,K) K ← K , ψ ← Enc ( p k , K ) ,返回 ( K , ψ ) (K,\psi) ( K , ψ ) ;KEM.Decap . K ′ ← Dec ( s k , ψ ) K'\leftarrow \text{Dec}(sk,\psi) K ′ ← Dec ( s k , ψ ) ,返回 K ′ K' K ′ 。💡
Theorem . 若 PKE 是 CPA 安全的,则这样的 KEM 也是 CPA 安全的。
【证明】 安全规约。反证,存在敌手 A \mathcal{A} A 打破了这个 KEM 的 CPA 安全性,则可以构造敌手 A ′ \mathcal{A}' A ′ 打破 PKE 的 CPA 安全性。
C ′ A ′ / C A ( p k , s k ) ← Gen ( 1 κ ) ⟶ p k ⟶ p k ⟵ K 0 , K 1 K 0 , K 1 ← K b ← { 0 , 1 } ψ ← Enc ( p k , K b ) ⟶ ψ ⟶ ( K 1 , ψ ) A ′ wins iff b ′ = b ⟵ b ′ ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C'} & & \mathcal{A'}/\mathcal{C} & & \mathcal{A}\\ (pk,sk) \leftarrow\text{Gen}(1^\kappa) &\stackrel{pk}{\longrightarrow} & &\stackrel{pk}{\longrightarrow}\\ &\stackrel{K_0,K_1}{\longleftarrow}&K_0,K_1\leftarrow\mathcal{K} \\ b\leftarrow\{0,1\}\\ \psi \leftarrow \text{Enc}(pk,K_b) & \stackrel{\psi}{\longrightarrow} & & \stackrel{(K_1,\psi)}{\longrightarrow} \\ \mathcal{A}' \text{ wins iff }b'=b& \stackrel{b'}{\longleftarrow}& & \stackrel{b'}{\longleftarrow}& \text{compute }b'\end{matrix} C ′ ( p k , s k ) ← Gen ( 1 κ ) b ← { 0 , 1 } ψ ← Enc ( p k , K b ) A ′ wins iff b ′ = b ⟶ p k ⟵ K 0 , K 1 ⟶ ψ ⟵ b ′ A ′ / C K 0 , K 1 ← K ⟶ p k ⟶ ( K 1 , ψ ) ⟵ b ′ A compute b ′ 那么,
Adv PKE , A ′ CPA ( κ ) = ∣ Pr [ b ′ = 1 ∣ b = 1 ] − Pr [ b ′ = 1 ∣ b = 0 ] ∣ = ∣ Pr [ Exp KEM , A CPA-1 ( κ ) = 1 ] − Pr [ Exp KEM , A CPA-0 ( κ ) = 1 ] ∣ = Adv KEM , A CPA ( κ ) \begin{aligned}\textbf{Adv}_{\text{PKE},\mathcal{A}'}^\text{CPA}(\kappa)&= \left|\text{Pr}[b'=1|b=1]-\text{Pr}[b'=1|b=0]\right|\\ &=\left|\text{Pr}[\textbf{Exp}_{\text{KEM},\mathcal{A}}^\text{CPA-1}(\kappa)=1]-\text{Pr}[\textbf{Exp}_{\text{KEM},\mathcal{A}}^\text{CPA-0}(\kappa)=1]\right|\\ &=\textbf{Adv}_{\text{KEM},\mathcal{A}}^\text{CPA}(\kappa)\end{aligned} Adv PKE , A ′ CPA ( κ ) = ∣ Pr [ b ′ = 1∣ b = 1 ] − Pr [ b ′ = 1∣ b = 0 ] ∣ = ∣ ∣ Pr [ Exp KEM , A CPA-1 ( κ ) = 1 ] − Pr [ Exp KEM , A CPA-0 ( κ ) = 1 ] ∣ ∣ = Adv KEM , A CPA ( κ ) 从而,若 PKE 是 CPA 安全的,则这样构造的 KEM 也是 CPA 安全的。
数据加密机制 (Data Encryption Mechanism, DEM) .(对称加密机制),包含 DEM.Enc/Dec .
DEM 的语义安全性 (semantic secure) . ∀ \forall ∀ PPT 敌手 A \mathcal{A} A ,
Adv DEM , A SEM ( κ ) = ∣ Pr [ Exp DEM , A SEM-1 ( κ ) = 1 ] − Pr [ Exp DEM , A SEM-0 ( κ ) = 1 ] ∣ = negl ( κ ) \begin{aligned}\textbf{Adv}_{\text{DEM},\mathcal{A}}^\text{SEM}(\kappa)=\left|\text{Pr}[\textbf{Exp}_{\text{DEM},\mathcal{A}}^\text{SEM-1}(\kappa)=1]-\text{Pr}[\textbf{Exp}_{\text{DEM},\mathcal{A}}^\text{SEM-0}(\kappa)=1]\right| = \text{negl}(\kappa)\end{aligned} Adv DEM , A SEM ( κ ) = ∣ ∣ Pr [ Exp DEM , A SEM-1 ( κ ) = 1 ] − Pr [ Exp DEM , A SEM-0 ( κ ) = 1 ] ∣ ∣ = negl ( κ ) 其中,b b b 实验 Exp DEM , A SEM-b ( κ ) \textbf{Exp}_{\text{DEM},\mathcal{A}}^\text{SEM-b}(\kappa) Exp DEM , A SEM-b ( κ ) 定义如下:
C A K ← K ⟵ m 0 , m 1 choose m 0 , m 1 c ← Enc ( K , m b ) ⟶ c return b ′ ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ K\leftarrow\mathcal{K}\\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\ c\leftarrow\text{Enc}(K,m_b) & \stackrel{c}{\longrightarrow} \\\text{return }b' &\stackrel{b'}{\longleftarrow} & \text{compute }b'\end{matrix} C K ← K c ← Enc ( K , m b ) return b ′ ⟵ m 0 , m 1 ⟶ c ⟵ b ′ A choose m 0 , m 1 compute b ′ KEM + DEM 混合加密体制 (KEM + DEM Hybrid Encryption) . 构造一个混合加密体制 PKE’,由 KEM 和 DEM 构成,包含:
PKE’.Gen’ . ( p k , s k ) ← KEM.Gen ( 1 κ ) (pk,sk)\leftarrow\text{KEM.Gen}(1^\kappa) ( p k , s k ) ← KEM.Gen ( 1 κ ) ,返回 ( p k , s k ) (pk,sk) ( p k , s k ) ;PKE’.Enc’ . ( K , ψ ) ← KEM.Encap ( p k ) ; c ← DEM.Enc ( K , m ) (K,\psi)\leftarrow \text{KEM.Encap}(pk);c\leftarrow\text{DEM.Enc}(K,m) ( K , ψ ) ← KEM.Encap ( p k ) ; c ← DEM.Enc ( K , m ) ,返回 ( ψ , c ) (\psi, c) ( ψ , c ) ;PKE’.Dec’ . K ′ ← KEM.Decap ( s k , ψ ) ; m ′ ← DEM.Dec ( K , c ) K' \leftarrow \text{KEM.Decap}(sk, \psi);m'\leftarrow\text{DEM.Dec}(K,c) K ′ ← KEM.Decap ( s k , ψ ) ; m ′ ← DEM.Dec ( K , c ) ,返回 m ′ m' m ′ 。混合加密体制 PKE’ 的 CPA 安全性 .
Adv PKE ′ , A CPA ( κ ) = ∣ Pr [ Exp PKE ′ , A CPA-1 ( κ ) = 1 ] − Pr [ Exp PKE ′ , A CPA-0 ( κ ) = 1 ] ∣ = negl ( κ ) \begin{aligned}\textbf{Adv}_{\text{PKE}',\mathcal{A}}^\text{CPA}(\kappa)=\left|\text{Pr}[\textbf{Exp}_{\text{PKE}',\mathcal{A}}^\text{CPA-1}(\kappa)=1]-\text{Pr}[\textbf{Exp}_{\text{PKE}',\mathcal{A}}^\text{CPA-0}(\kappa)=1]\right| = \text{negl}(\kappa)\end{aligned} Adv PKE ′ , A CPA ( κ ) = ∣ ∣ Pr [ Exp PKE ′ , A CPA-1 ( κ ) = 1 ] − Pr [ Exp PKE ′ , A CPA-0 ( κ ) = 1 ] ∣ ∣ = negl ( κ ) 其中,b b b 实验 Exp PKE ′ , A CPA-b ( κ ) = 1 \textbf{Exp}_{\text{PKE}',\mathcal{A}}^\text{CPA-b}(\kappa)=1 Exp PKE ′ , A CPA-b ( κ ) = 1 定义如下:
C A ( p k , s k ) ← Gen ′ ( 1 κ ) ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 ( ψ , c ) ← Enc ′ ( p k , m ) ⟶ ( ψ , c ) return b ′ ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk)\leftarrow\text{Gen}'(1^\kappa) & \stackrel{pk}{\longrightarrow}\\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\(\psi,c)\leftarrow\text{Enc}'(pk,m) & \stackrel{(\psi,c)}{\longrightarrow} \\\text{return }b' &\stackrel{b'}{\longleftarrow} & \text{compute }b'\end{matrix} C ( p k , s k ) ← Gen ′ ( 1 κ ) ( ψ , c ) ← Enc ′ ( p k , m ) return b ′ ⟶ p k ⟵ m 0 , m 1 ⟶ ( ψ , c ) ⟵ b ′ A choose m 0 , m 1 compute b ′ 💡
Theorem . 如果 KEM 是 CPA 安全的,DEM 是语义安全的,那么 PKE’ 就是 CPA 安全的。
【证明 1】 从 advantage 入手,利用中间状态完成从 0 实验 Exp PKE ′ , A CPA-0 ( κ ) \textbf{Exp}_{\text{PKE}',\mathcal{A}}^\text{CPA-0}(\kappa) Exp PKE ′ , A CPA-0 ( κ ) 到 1 实验 Exp PKE ′ , A CPA-1 ( κ ) \textbf{Exp}_{\text{PKE}',\mathcal{A}}^\text{CPA-1}(\kappa) Exp PKE ′ , A CPA-1 ( κ ) 的转化。
Game 1 : Exp PKE ′ , A CPA-0 ( κ ) \textbf{Exp}_{\text{PKE}',\mathcal{A}}^\text{CPA-0}(\kappa) Exp PKE ′ , A CPA-0 ( κ ) .
C A ( p k , s k ) ← Gen ′ ( 1 κ ) ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) c ∗ ← DEM.Enc ( K ∗ , m 0 ) ⟶ ( ψ ∗ , c ∗ ) return b ′ ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk)\leftarrow\text{Gen}'(1^\kappa) & \stackrel{pk}{\longrightarrow}\\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\ (K^*,\psi^*)\leftarrow\text{KEM.Encap}(pk)\\c^*\leftarrow\text{DEM.Enc}(K^*,m_0) & \stackrel{(\psi^*,c^*)}{\longrightarrow} \\\text{return }b' &\stackrel{b'}{\longleftarrow} & \text{compute }b'\end{matrix} C ( p k , s k ) ← Gen ′ ( 1 κ ) ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) c ∗ ← DEM.Enc ( K ∗ , m 0 ) return b ′ ⟶ p k ⟵ m 0 , m 1 ⟶ ( ψ ∗ , c ∗ ) ⟵ b ′ A choose m 0 , m 1 compute b ′ Game 2 :
C A ( p k , s k ) ← Gen ′ ( 1 κ ) ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) K ← K c ∗ ← DEM.Enc ( K , m 0 ) ⟶ ( ψ ∗ , c ∗ ) return b ′ ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk)\leftarrow\text{Gen}'(1^\kappa) & \stackrel{pk}{\longrightarrow}\\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\ (K^*,\psi^*)\leftarrow\text{KEM.Encap}(pk)\\ {\color{red}K
\leftarrow\mathcal{K}}\\c^*\leftarrow\text{DEM.Enc}({\color{red} K},m_0) & \stackrel{(\psi^*,c^*)}{\longrightarrow} \\\text{return }b' &\stackrel{b'}{\longleftarrow} & \text{compute }b'\end{matrix} C ( p k , s k ) ← Gen ′ ( 1 κ ) ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) K ← K c ∗ ← DEM.Enc ( K , m 0 ) return b ′ ⟶ p k ⟵ m 0 , m 1 ⟶ ( ψ ∗ , c ∗ ) ⟵ b ′ A choose m 0 , m 1 compute b ′ Game 3 .
C A ( p k , s k ) ← Gen ′ ( 1 κ ) ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) K ← K c ∗ ← DEM.Enc ( K , m 1 ) ⟶ ( ψ ∗ , c ∗ ) return b ′ ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk)\leftarrow\text{Gen}'(1^\kappa) & \stackrel{pk}{\longrightarrow}\\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\ (K^*,\psi^*)\leftarrow\text{KEM.Encap}(pk)\\ K
\leftarrow\mathcal{K}\\c^*\leftarrow\text{DEM.Enc}(K,{\color{red}m_1}) & \stackrel{(\psi^*,c^*)}{\longrightarrow} \\\text{return }b' &\stackrel{b'}{\longleftarrow} & \text{compute }b'\end{matrix} C ( p k , s k ) ← Gen ′ ( 1 κ ) ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) K ← K c ∗ ← DEM.Enc ( K , m 1 ) return b ′ ⟶ p k ⟵ m 0 , m 1 ⟶ ( ψ ∗ , c ∗ ) ⟵ b ′ A choose m 0 , m 1 compute b ′ Game 4 . Exp PKE ′ , A CPA-1 ( κ ) \textbf{Exp}_{\text{PKE}',\mathcal{A}}^\text{CPA-1}(\kappa) Exp PKE ′ , A CPA-1 ( κ ) .
C A ( p k , s k ) ← Gen ′ ( 1 κ ) ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) c ∗ ← DEM.Enc ( K ∗ , m 1 ) ⟶ ( ψ ∗ , c ∗ ) return b ′ ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk)\leftarrow\text{Gen}'(1^\kappa) & \stackrel{pk}{\longrightarrow}\\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\ (K^*,\psi^*)\leftarrow\text{KEM.Encap}(pk)\\c^*\leftarrow\text{DEM.Enc}(K^*,m_1) & \stackrel{(\psi^*,c^*)}{\longrightarrow} \\\text{return }b' &\stackrel{b'}{\longleftarrow} & \text{compute }b'\end{matrix} C ( p k , s k ) ← Gen ′ ( 1 κ ) ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) c ∗ ← DEM.Enc ( K ∗ , m 1 ) return b ′ ⟶ p k ⟵ m 0 , m 1 ⟶ ( ψ ∗ , c ∗ ) ⟵ b ′ A choose m 0 , m 1 compute b ′ 首先,我们说明 ∣ Pr [ Game 2 = 1 ] − Pr [ Game 1 = 1 ] ∣ ≤ Adv KEM CPA ( κ ) \left|\text{Pr}[\textbf{Game 2}=1]-\text{Pr}[\textbf{Game 1}=1]\right| \leq \textbf{Adv}_{\text{KEM}}^\text{CPA}(\kappa) ∣ Pr [ Game 2 = 1 ] − Pr [ Game 1 = 1 ] ∣ ≤ Adv KEM CPA ( κ ) 。也就是说,我们可以通过区分 Game 1 和 Game 2 的敌手(返回 1 的概率不可忽略的不同)来打破 CPA 安全性。
C ′ A ′ / C A ( p k , s k ) ← Gen ( 1 κ ) ⟶ p k ⟶ p k ⟵ m 0 , m 1 ⟵ m 0 , m 1 choose m 0 , m 1 K 0 ∗ ← K b ← { 0 , 1 } ( K 1 ∗ , ψ ∗ ) ← Encap ( p k ) K ∗ : = K b ∗ ⟶ K ∗ , ψ ∗ c ∗ ← Enc ( K ∗ , m 0 ) ⟶ ( ψ ∗ , c ∗ ) ⟵ b ′ ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C'} & & \mathcal{A'}/\mathcal{C} & & \mathcal{A}\\ (pk,sk) \leftarrow\text{Gen}(1^\kappa) &\stackrel{pk}{\longrightarrow} & &\stackrel{pk}{\longrightarrow}\\ & \stackrel{m_0,m_1}{\longleftarrow}& & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\K_0^*\leftarrow\mathcal{K}\\b\leftarrow\{0,1\}\\(K_1^*,\psi^*)\leftarrow\text{Encap}(pk) \\K^*:=K_b^* & \stackrel{K^*,\psi^*}{\longrightarrow} & c^* \leftarrow\text{Enc}(K^*,m_0) &\stackrel{(\psi^*,c^*)}{\longrightarrow}\\ &\stackrel{b'}{\longleftarrow} & & \stackrel{b'}{\longleftarrow}& \text{compute }b' \end{matrix} C ′ ( p k , s k ) ← Gen ( 1 κ ) K 0 ∗ ← K b ← { 0 , 1 } ( K 1 ∗ , ψ ∗ ) ← Encap ( p k ) K ∗ := K b ∗ ⟶ p k ⟵ m 0 , m 1 ⟶ K ∗ , ψ ∗ ⟵ b ′ A ′ / C c ∗ ← Enc ( K ∗ , m 0 ) ⟶ p k ⟵ m 0 , m 1 ⟶ ( ψ ∗ , c ∗ ) ⟵ b ′ A choose m 0 , m 1 compute b ′ 当 b = 0 b=0 b = 0 ,进行 Game 2 ;当 b = 1 b=1 b = 1 ,进行 Game 1 ;于是
∣ Pr [ Game 2 = 1 ] − Pr [ Game 1 = 1 ] ∣ = ∣ Pr [ b ′ = 1 ∣ b = 0 ] − Pr [ b ′ = 1 ∣ b = 1 ] ∣ = Adv KEM , A ′ CPA ( κ ) ≤ Adv KEM CPA ( κ ) \begin{aligned}&\left|\text{Pr}[\textbf{Game 2}=1]-\text{Pr}[\textbf{Game 1}=1]\right| \\ =\ &\left|\text{Pr}[b'=1|b=0]-\text{Pr}[b'=1|b=1]\right| \\=\ & \textbf{Adv}_{\text{KEM},\mathcal{A}'}^\text{CPA}(\kappa)\\ \leq\ & \textbf{Adv}_{\text{KEM}}^\text{CPA}(\kappa)\end{aligned} = = ≤ ∣ Pr [ Game 2 = 1 ] − Pr [ Game 1 = 1 ] ∣ ∣ Pr [ b ′ = 1∣ b = 0 ] − Pr [ b ′ = 1∣ b = 1 ] ∣ Adv KEM , A ′ CPA ( κ ) Adv KEM CPA ( κ ) 同理
∣ Pr [ Game 4 = 1 ] − Pr [ Game 3 = 1 ] ∣ ≤ Adv KEM CPA ( κ ) \left|\text{Pr}[\textbf{Game 4}=1]-\text{Pr}[\textbf{Game 3}=1]\right| \leq \textbf{Adv}_{\text{KEM}}^\text{CPA}(\kappa) ∣ Pr [ Game 4 = 1 ] − Pr [ Game 3 = 1 ] ∣ ≤ Adv KEM CPA ( κ ) 那么接下来我们考虑说明 ∣ Pr [ Game 3 = 1 ] − Pr [ Game 2 = 1 ] ∣ ≤ Adv DEM SEM ( κ ) \left|\text{Pr}[\textbf{Game 3}=1]-\text{Pr}[\textbf{Game 2}=1]\right| \leq \textbf{Adv}_{\text{DEM}}^\text{SEM}(\kappa) ∣ Pr [ Game 3 = 1 ] − Pr [ Game 2 = 1 ] ∣ ≤ Adv DEM SEM ( κ ) 。也就是说,我们可以通过区分 Game 2 和 Game 3 的敌手(返回 1 的概率不可忽略的不同)来突破 DEM 的 SEM 安全性。这个规约是简单的(都是区别 m 0 m_0 m 0 和 m 1 m_1 m 1 ),直接调用即可,在这里略去过程。
于是,综上所述,
Adv PKE ′ , A CPA ( κ ) = ∣ Pr [ Exp PKE ′ , A CPA-1 ( κ ) = 1 ] − Pr [ Exp PKE ′ , A CPA-0 ( κ ) = 1 ] ∣ = ∑ i = 2 4 ∣ Pr [ Game i = 1 ] − Pr [ Game i − 1 = 1 ] ∣ ≤ Adv KEM CPA ( κ ) + Adv KEM CPA ( κ ) + Adv DEM SEM ( κ ) = 2 Adv KEM CPA ( κ ) + Adv DEM SEM ( κ ) = 3 negl ( κ ) = negl ( κ ) \begin{aligned}\textbf{Adv}_{\text{PKE}',\mathcal{A}}^\text{CPA}(\kappa) &=\left|\text{Pr}[\textbf{Exp}_{\text{PKE}',\mathcal{A}}^\text{CPA-1}(\kappa)=1]-\text{Pr}[\textbf{Exp}_{\text{PKE}',\mathcal{A}}^\text{CPA-0}(\kappa)=1]\right| \\ &= \sum_{i=2}^4 |\text{Pr}[\textbf{Game }i=1]-\text{Pr}[\textbf{Game }i-1=1]| \\ &\leq \textbf{Adv}_{\text{KEM}}^\text{CPA}(\kappa) + \textbf{Adv}_{\text{KEM}}^\text{CPA}(\kappa) + \textbf{Adv}_{\text{DEM}}^\text{SEM}(\kappa) \\ &= 2\textbf{Adv}_{\text{KEM}}^\text{CPA}(\kappa) + \textbf{Adv}_{\text{DEM}}^\text{SEM}(\kappa)\\ &= 3\text{negl}(\kappa)\\ &= \text{negl}(\kappa)\end{aligned} Adv PKE ′ , A CPA ( κ ) = ∣ ∣ Pr [ Exp PKE ′ , A CPA-1 ( κ ) = 1 ] − Pr [ Exp PKE ′ , A CPA-0 ( κ ) = 1 ] ∣ ∣ = i = 2 ∑ 4 ∣ Pr [ Game i = 1 ] − Pr [ Game i − 1 = 1 ] ∣ ≤ Adv KEM CPA ( κ ) + Adv KEM CPA ( κ ) + Adv DEM SEM ( κ ) = 2 Adv KEM CPA ( κ ) + Adv DEM SEM ( κ ) = 3 negl ( κ ) = negl ( κ ) 【证明 2】 从原始定义入手(与 1/2 的差可忽略)
Game 1 . (即为 PKE‘ 的 CPA game)定义赢了 Game 1 为 Succ 1 \text{Succ}_1 Succ 1 ,即 Pr [ Succ 1 ] = Pr [ b ′ = b in Game 1 ] \text{Pr}[\text{Succ}_1]=\text{Pr}[b'=b\text{ in Game 1}] Pr [ Succ 1 ] = Pr [ b ′ = b in Game 1 ] 。
C A ( p k , s k ) ← Gen ′ ( 1 κ ) ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 b ← { 0 , 1 } ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) c ∗ ← DEM.Enc ( K ∗ , m b ) ⟶ ( ψ ∗ , c ∗ ) A wins iff b ′ = b ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk)\leftarrow\text{Gen}'(1^\kappa) & \stackrel{pk}{\longrightarrow}\\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\b \leftarrow \{0,1\}\\ (K^*,\psi^*)\leftarrow\text{KEM.Encap}(pk)\\c^*\leftarrow\text{DEM.Enc}(K^*,m_b) & \stackrel{(\psi^*,c^*)}{\longrightarrow} \\\mathcal{A}\text{ wins iff }b' =b &\stackrel{b'}{\longleftarrow} & \text{compute }b'\end{matrix} C ( p k , s k ) ← Gen ′ ( 1 κ ) b ← { 0 , 1 } ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) c ∗ ← DEM.Enc ( K ∗ , m b ) A wins iff b ′ = b ⟶ p k ⟵ m 0 , m 1 ⟶ ( ψ ∗ , c ∗ ) ⟵ b ′ A choose m 0 , m 1 compute b ′ Game 2 . 如下,定义赢了 Game 1 为 Succ 2 \text{Succ}_2 Succ 2 ,即 Pr [ Succ 2 ] = Pr [ b ′ = b in Game 2 ] \text{Pr}[\text{Succ}_2]=\text{Pr}[b'=b\text{ in Game 2}] Pr [ Succ 2 ] = Pr [ b ′ = b in Game 2 ]
C A ( p k , s k ) ← Gen ′ ( 1 κ ) ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 b ← { 0 , 1 } ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) K ← K c ∗ ← DEM.Enc ( K , m b ) ⟶ ( ψ ∗ , c ∗ ) A wins iff b ′ = b ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk)\leftarrow\text{Gen}'(1^\kappa) & \stackrel{pk}{\longrightarrow}\\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\b \leftarrow \{0,1\}\\ (K^*,\psi^*)\leftarrow\text{KEM.Encap}(pk)\\{\color{red}K\leftarrow \mathcal{K}} \\c^*\leftarrow\text{DEM.Enc}({\color{red}K},m_b) & \stackrel{(\psi^*,c^*)}{\longrightarrow} \\\mathcal{A}\text{ wins iff }b' =b &\stackrel{b'}{\longleftarrow} & \text{compute }b'\end{matrix} C ( p k , s k ) ← Gen ′ ( 1 κ ) b ← { 0 , 1 } ( K ∗ , ψ ∗ ) ← KEM.Encap ( p k ) K ← K c ∗ ← DEM.Enc ( K , m b ) A wins iff b ′ = b ⟶ p k ⟵ m 0 , m 1 ⟶ ( ψ ∗ , c ∗ ) ⟵ b ′ A choose m 0 , m 1 compute b ′ 类似地,我们说明 ∣ Pr [ Succ 2 ] − Pr [ Succ 1 ] ∣ ≤ Adv KEM CPA ( κ ) |\text{Pr}[\text{Succ}_2]-\text{Pr}[\text{Succ}_1]| \leq \textbf{Adv}_{\text{KEM}}^\text{CPA}(\kappa) ∣ Pr [ Succ 2 ] − Pr [ Succ 1 ] ∣ ≤ Adv KEM CPA ( κ ) 。也就是说,我们可以通过一个在 Game 1 和 Game 2 中赢的概率不同的敌手来打破 KEM 的 CPA 安全性。
C ′ A ′ / C A ( p k , s k ) ← Gen ( 1 κ ) ⟶ p k ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 K 0 ∗ ← K β ← { 0 , 1 } ( K 1 ∗ , ψ ∗ ) ← Encap ( p k ) K ∗ : = K β ∗ ⟶ K ∗ , ψ ∗ b ← { 0 , 1 } c ∗ ← Enc ( K ∗ , m b ) ⟶ ( ψ ∗ , c ∗ ) ⟵ β ′ β ′ : = 1 [ b ′ = b ] ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C'} & & \mathcal{A'}/\mathcal{C} & & \mathcal{A}\\ (pk,sk) \leftarrow\text{Gen}(1^\kappa) &\stackrel{pk}{\longrightarrow} & &\stackrel{pk}{\longrightarrow}\\ & & & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\K_0^*\leftarrow\mathcal{K}\\\beta\leftarrow\{0,1\}\\(K_1^*,\psi^*)\leftarrow\text{Encap}(pk) \\K^*:=K_\beta^* & \stackrel{K^*,\psi^*}{\longrightarrow}& b\leftarrow\{0,1\}\\ & &c^* \leftarrow\text{Enc}(K^*,m_b)&\stackrel{(\psi^*,c^*)}{\longrightarrow}\\ &\stackrel{\beta'}{\longleftarrow} & \beta' := \mathbf{1}[b'=b]& \stackrel{b'}{\longleftarrow}& \text{compute }b' \end{matrix} C ′ ( p k , s k ) ← Gen ( 1 κ ) K 0 ∗ ← K β ← { 0 , 1 } ( K 1 ∗ , ψ ∗ ) ← Encap ( p k ) K ∗ := K β ∗ ⟶ p k ⟶ K ∗ , ψ ∗ ⟵ β ′ A ′ / C b ← { 0 , 1 } c ∗ ← Enc ( K ∗ , m b ) β ′ := 1 [ b ′ = b ] ⟶ p k ⟵ m 0 , m 1 ⟶ ( ψ ∗ , c ∗ ) ⟵ b ′ A choose m 0 , m 1 compute b ′ 在上面的规约中,我们在中间再抛一次币。如果左边抛币的结果 β = 0 \beta = 0 β = 0 ,那么相当于给有能力的敌手模拟了 Game 2;如果左边抛币的结果 β = 1 \beta = 1 β = 1 ,那么相当于给有能力的敌手模拟了 Game 1,由于该有能力的敌手赢 Game 1 和 Game 2 的概率显著不同,即
Pr [ β ′ = 1 ∣ β = 1 ] = Pr [ A wins Game 1 ] = Pr [ Succ 1 ] Pr [ β ′ = 1 ∣ β = 0 ] = Pr [ A wins Game 2 ] = Pr [ Succ 2 ] \text{Pr}[\beta'=1|\beta = 1]=\text{Pr}[\mathcal{A} \text{ wins Game 1}] = \text{Pr}[\text{Succ}_1] \\ \text{Pr}[\beta'=1|\beta = 0]=\text{Pr}[\mathcal{A} \text{ wins Game 2}] = \text{Pr}[\text{Succ}_2] Pr [ β ′ = 1∣ β = 1 ] = Pr [ A wins Game 1 ] = Pr [ Succ 1 ] Pr [ β ′ = 1∣ β = 0 ] = Pr [ A wins Game 2 ] = Pr [ Succ 2 ] 从而,
∣ Pr [ Succ 1 ] − Pr [ Succ 2 ] ∣ = ∣ Pr [ β ′ = 1 ∣ β = 1 ] − Pr [ β ′ = 1 ∣ β = 0 ] ∣ ≤ Adv KEM CPA ( κ ) \begin{aligned}\left|\text{Pr}[\text{Succ}_1]-\text{Pr}[\text{Succ}_2]\right|&=\left|\text{Pr}[\beta'=1|\beta = 1]-\text{Pr}[\beta'=1|\beta = 0]\right| \\&\leq \textbf{Adv}_{\text{KEM}}^\text{CPA}(\kappa)\end{aligned} ∣ Pr [ Succ 1 ] − Pr [ Succ 2 ] ∣ = ∣ Pr [ β ′ = 1∣ β = 1 ] − Pr [ β ′ = 1∣ β = 0 ] ∣ ≤ Adv KEM CPA ( κ ) 另一方面,我们想要说明 ∣ Pr [ Succ 2 ] − 1 2 ∣ ≤ 1 2 Adv DEM SEM ( κ ) |\text{Pr}[\text{Succ}_2]-\frac{1}{2}| \leq \frac{1}{2}\textbf{Adv}_{\text{DEM}}^\text{SEM}(\kappa) ∣ Pr [ Succ 2 ] − 2 1 ∣ ≤ 2 1 Adv DEM SEM ( κ ) 。也就是说,我们可以通过一个在 Game 2 赢的概率和 1/2 不可忽略地不同的敌手来打破 DEM 的 SEM 安全性。
C ′ A ′ / C A K ← K ( p k , s k ) ← Gen ( 1 κ ) ⟶ p k ⟵ m 0 , m 1 ⟵ m 0 , m 1 choose m 0 , m 1 b ← { 0 , 1 } c ← Enc ( K , m b ) ⟶ c ( K ∗ , ψ ∗ ) = Encap ( p k ) ⟶ ( ψ ∗ , c ) ⟵ b ′ ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C'} & & \mathcal{A'}/\mathcal{C} & & \mathcal{A}\\ K\leftarrow \mathcal{K} \\ & & (pk,sk)\leftarrow\text{Gen}(1^\kappa) & \stackrel{pk}{\longrightarrow}\\& \stackrel{m_0,m_1}{\longleftarrow}& & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1\\b\leftarrow\{0,1\}\\c \leftarrow \text{Enc}(K,m_b) & \stackrel{c}{\longrightarrow} &(K^*,\psi^*)=\text{Encap}(pk) & \stackrel{(\psi^*,c)}{\longrightarrow}\\&\stackrel{b'}{\longleftarrow} && \stackrel{b'}{\longleftarrow}& \text{compute }b' \end{matrix} C ′ K ← K b ← { 0 , 1 } c ← Enc ( K , m b ) ⟵ m 0 , m 1 ⟶ c ⟵ b ′ A ′ / C ( p k , s k ) ← Gen ( 1 κ ) ( K ∗ , ψ ∗ ) = Encap ( p k ) ⟶ p k ⟵ m 0 , m 1 ⟶ ( ψ ∗ , c ) ⟵ b ′ A choose m 0 , m 1 compute b ′ ∣ Pr [ Succ 2 ] − 1 2 ∣ = ∣ Pr [ b ′ = b ] − 1 2 ∣ = ∣ Pr [ C ′ wins ] − 1 2 ∣ ≤ 1 2 Adv DEM SEM ( κ ) \left|\text{Pr}[\text{Succ}_2]-\frac{1}{2}\right| = \left|\text{Pr}[b'=b]-\frac{1}{2}\right|=\left|\text{Pr}[\mathcal{C'}\text{ wins}]-\frac{1}{2}\right|\leq \frac{1}{2}\textbf{Adv}_{\text{DEM}}^\text{SEM}(\kappa) ∣ ∣ Pr [ Succ 2 ] − 2 1 ∣ ∣ = ∣ ∣ Pr [ b ′ = b ] − 2 1 ∣ ∣ = ∣ ∣ Pr [ C ′ wins ] − 2 1 ∣ ∣ ≤ 2 1 Adv DEM SEM ( κ ) 综上所述,
∣ Pr [ Succ 1 ] − 1 2 ∣ = ∣ Pr [ Succ 1 ] − Pr [ Succ 2 ] + Pr [ Succ 2 ] − 1 2 ∣ ≤ ∣ Pr [ Succ 1 ] − Pr [ Succ 2 ] ∣ + ∣ Pr [ Succ 2 ] − 1 2 ∣ ≤ Adv KEM CPA ( κ ) + 1 2 Adv DEM SEM ( κ ) = 3 2 negl ( κ ) = negl ( κ ) \begin{aligned}\left|\text{Pr}[\text{Succ}_1]-\frac{1}{2}\right|&=\left|\text{Pr}[\text{Succ}_1]-\text{Pr}[\text{Succ}_2]+\text{Pr}[\text{Succ}_2]-\frac{1}{2}\right| \\ &\le \left|\text{Pr}[\text{Succ}_1]-\text{Pr}[\text{Succ}_2]\right| +\left|\text{Pr}[\text{Succ}_2]-\frac{1}{2}\right| \\ &\leq \textbf{Adv}_{\text{KEM}}^\text{CPA}(\kappa) +\frac{1}{2} \textbf{Adv}_{\text{DEM}}^\text{SEM}(\kappa) \\ &= \frac{3}{2}\text{negl}(\kappa)\\ &= \text{negl}(\kappa)\end{aligned} ∣ ∣ Pr [ Succ 1 ] − 2 1 ∣ ∣ = ∣ ∣ Pr [ Succ 1 ] − Pr [ Succ 2 ] + Pr [ Succ 2 ] − 2 1 ∣ ∣ ≤ ∣ Pr [ Succ 1 ] − Pr [ Succ 2 ] ∣ + ∣ ∣ Pr [ Succ 2 ] − 2 1 ∣ ∣ ≤ Adv KEM CPA ( κ ) + 2 1 Adv DEM SEM ( κ ) = 2 3 negl ( κ ) = negl ( κ ) Game 1 即为 PKE‘ 的 CPA game ,于是我们知道,对于任意敌手,其赢得 PKE‘ 的 CPA game 的概率与 1/2 都没有显著差别,于是 PKE‘ 是 CPA 安全的。
🔑
在上述证明中,我们使用了
Adv * * ( κ ) = max A Adv * , A * ( κ ) \textbf{Adv}_{\text{*}}^\text{*}(\kappa) = \max_\mathcal{A} \textbf{Adv}_{\text{*},\mathcal{A}}^\text{*}(\kappa) Adv * * ( κ ) = A max Adv * , A * ( κ ) ElGamal 加密模式:Efficient PKE
令 GroupGen ( 1 κ ) \text{GroupGen}(1^\kappa) GroupGen ( 1 κ ) 为一个循环群生成算法,输出循环群 G \mathbb{G} G 、其阶数 q q q 和生成元 g g g 。
ElGamal.Gen . ( G , q , g ) ← GroupGen ( 1 κ ) ; x ← Z q , y : = g x ; (\mathbb{G},q,g)\leftarrow\text{GroupGen}(1^\kappa);x\leftarrow \mathbb{Z}_q,y:=g^x; ( G , q , g ) ← GroupGen ( 1 κ ) ; x ← Z q , y := g x ; 公钥 p k : = ( ( G , q , g ) , y ) pk:=((\mathbb{G},q,g),y) p k := (( G , q , g ) , y ) 私钥 s k : = x sk := x s k := x ,返回 ( p k , s k ) (pk,sk) ( p k , s k ) ;ElGamal.Enc . r ← Z q , m ∈ M = G r \leftarrow \mathbb{Z}_q,m\in\mathcal{M}=\mathbb{G} r ← Z q , m ∈ M = G ; c 1 : = g r , c 2 : = y r m c_1:=g^r, c_2:=y^rm c 1 := g r , c 2 := y r m ,返回 ( c 1 , c 2 ) (c_1,c_2) ( c 1 , c 2 ) ;ElGamal.Dec . m ′ : = c 2 / c 1 x m':=c_2/c_1^x m ′ := c 2 / c 1 x ,返回 m ′ m' m ′ 。正确性 . c 2 = y r m = g x r m = c 1 x m c_2 = y^rm = g^{xr}m = c_1^xm c 2 = y r m = g x r m = c 1 x m .
🔑
离散对数问题/假设 (Discrete Logarithm, DL Problem/Assumption) .
Pr [ ( G , q , g ) ← GroupGen ( 1 κ ) ; x ← Z q ; y : = g x , x ′ ← A ( G , q , g , y ) : x ′ = x ] = negl ( κ ) \text{Pr}\left[\begin{matrix}(\mathbb{G},q,g)\leftarrow\text{GroupGen}(1^\kappa);x\leftarrow \mathbb{Z}_q;\\y:=g^x,x'\leftarrow\mathcal{A}(G,q,g,y)\end{matrix}:x'=x\right]=\text{negl}(\kappa) Pr [ ( G , q , g ) ← GroupGen ( 1 κ ) ; x ← Z q ; y := g x , x ′ ← A ( G , q , g , y ) : x ′ = x ] = negl ( κ ) Computational Diffie-Hellman, CDH Problem/Assumption .
Pr [ ( G , q , g ) ← GroupGen ( 1 κ ) ; x ← Z q ; y ← Z q ; T ← A ( G , q , g , g x , g y ) : T = g x y ] = negl ( κ ) \text{Pr}\left[\begin{matrix}(\mathbb{G},q,g)\leftarrow\text{GroupGen}(1^\kappa);x\leftarrow \mathbb{Z}_q;y\leftarrow\mathbb{Z}_q;\\T\leftarrow\mathcal{A}(G,q,g,g^x,g^y)\end{matrix}:T=g^{xy}\right]=\text{negl}(\kappa) Pr [ ( G , q , g ) ← GroupGen ( 1 κ ) ; x ← Z q ; y ← Z q ; T ← A ( G , q , g , g x , g y ) : T = g x y ] = negl ( κ ) Decisional Diffie-Hellman, DDH Problem/Assumption . 令 X = { X κ } , Y = { Y κ } \mathcal{X}=\{\mathcal{X}_\kappa\},\mathcal{Y}=\{\mathcal{Y}_\kappa\} X = { X κ } , Y = { Y κ } ,且
X κ : = { ( G , q , g ) ← GroupGen ( 1 κ ) ; a , b , c ← Z q : ( G , q , g , g a , g b , g c ) } Y κ : = { ( G , q , g ) ← GroupGen ( 1 κ ) ; a , b ← Z q : ( G , q , g , g a , g b , g a b ) } \mathcal{X}_\kappa:=\{(\mathbb{G},q,g)\leftarrow\text{GroupGen}(1^\kappa);a,b,c\leftarrow\mathbb{Z}_q:(\mathbb{G},q,g,g^a,g^b,g^c)\} \\ \mathcal{Y}_\kappa:=\{(\mathbb{G},q,g)\leftarrow\text{GroupGen}(1^\kappa);a,b\leftarrow\mathbb{Z}_q:(\mathbb{G},q,g,g^a,g^b,g^{ab})\} X κ := {( G , q , g ) ← GroupGen ( 1 κ ) ; a , b , c ← Z q : ( G , q , g , g a , g b , g c )} Y κ := {( G , q , g ) ← GroupGen ( 1 κ ) ; a , b ← Z q : ( G , q , g , g a , g b , g ab )} DDH assumption: X ≈ c Y \mathcal{X}\approx_c \mathcal{Y} X ≈ c Y ,即多项式敌手无法区分 X , Y \mathcal{X},\mathcal{Y} X , Y 。
🌟 问题难度:DL > CDH > DDH . ElGamal 基于 DDH 问题。
ElGamal 模式 CPA 安全 . 如果生成的群满足 DDH assumption,那么 ElGamal 模式是 CPA 安全的。
Game 1 . (CPA Game ) Pr [ Succ 1 ] : = Pr [ A wins in the Game 1 ] = Pr [ b = b ′ in Game 1 ] \text{Pr}[\text{Succ}_1] := \text{Pr}[\mathcal{A} \text{ wins in the Game 1}]=\text{Pr}[b=b' \text{ in Game 1}] Pr [ Succ 1 ] := Pr [ A wins in the Game 1 ] = Pr [ b = b ′ in Game 1 ] .
C A ( p k , s k ) ← Gen ( 1 κ ) p k : = ( ( G , q , g ) , y ) , s k : = x ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 b ← { 0 , 1 } r ← Z q c : = ( c 1 : = g r , c 2 : = m b y r = m b ( g r ) x ) ⟶ c A wins iff b ′ = b ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk)\leftarrow\text{Gen}(1^\kappa) \\ pk:=((\mathbb{G},q,g),y),sk:=x & \stackrel{pk}{\longrightarrow} \\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\ b\leftarrow\{0,1\} \\r\leftarrow\mathbb{Z}_q\\c:=(c_1:=g^r,c_2:={\color{red}m_by^r=m_b(g^r)^x}) & \stackrel{c}{\longrightarrow}\\ \mathcal{A}\text{ wins iff }b'=b & \stackrel{b'}{\longleftarrow}&\text{compute }b'\end{matrix} C ( p k , s k ) ← Gen ( 1 κ ) p k := (( G , q , g ) , y ) , s k := x b ← { 0 , 1 } r ← Z q c := ( c 1 := g r , c 2 := m b y r = m b ( g r ) x ) A wins iff b ′ = b ⟶ p k ⟵ m 0 , m 1 ⟶ c ⟵ b ′ A choose m 0 , m 1 compute b ′ 红色部分是恒等式,因为 y = g x y = g^x y = g x (生成部分的公式)。 Game 2 . Pr [ Succ 2 ] : = Pr [ A wins in the Game 2 ] = Pr [ b = b ′ in Game 2 ] \text{Pr}[\text{Succ}_2] := \text{Pr}[\mathcal{A} \text{ wins in the Game 2}]=\text{Pr}[b=b' \text{ in Game 2}] Pr [ Succ 2 ] := Pr [ A wins in the Game 2 ] = Pr [ b = b ′ in Game 2 ]
C A ( p k , s k ) ← Gen ( 1 κ ) p k : = ( ( G , q , g ) , y ) , s k : = x ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 b ← { 0 , 1 } r ← Z q , r ′ ← Z q c : = ( c 1 : = g r , c 2 : = m b ( g r ′ ) ) ⟶ c A wins iff b ′ = b ⟵ b ′ compute b ′ \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk)\leftarrow\text{Gen}(1^\kappa) \\ pk:=((\mathbb{G},q,g),y),sk:=x & \stackrel{pk}{\longrightarrow} \\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0,m_1 \\ b\leftarrow\{0,1\} \\r\leftarrow\mathbb{Z}_q,r'\leftarrow \mathbb{Z}_q\\c:=(c_1:=g^r,c_2:={\color{red}m_b(g^{r'})}) & \stackrel{c}{\longrightarrow}\\ \mathcal{A}\text{ wins iff }b'=b & \stackrel{b'}{\longleftarrow}&\text{compute }b'\end{matrix} C ( p k , s k ) ← Gen ( 1 κ ) p k := (( G , q , g ) , y ) , s k := x b ← { 0 , 1 } r ← Z q , r ′ ← Z q c := ( c 1 := g r , c 2 := m b ( g r ′ ) ) A wins iff b ′ = b ⟶ p k ⟵ m 0 , m 1 ⟶ c ⟵ b ′ A choose m 0 , m 1 compute b ′ c 2 c_2 c 2 是完全均匀随机 (m b m_b m b 给定且 g r ′ g^{r'} g r ′ 均匀随机分布),且 c 1 , c 2 c_1,c_2 c 1 , c 2 独立且都均匀随机分布,因此敌手拿到的信息和 b b b 完全无关,肯定无法猜出来 b ′ b' b ′ ,和随机猜没有区别,因此我们知道Pr [ Succ 2 ] = 1 2 \text{Pr}[\text{Succ}_2]=\frac{1}{2} Pr [ Succ 2 ] = 2 1 因此,我们可以通过证明如下命题来证明 ElGamal 的 CPA 安全性。
∣ Pr [ A wins ] − 1 2 ∣ = ∣ Pr [ Succ 1 ] − Pr [ Succ 2 ] ∣ ≤ Adv DDH ( κ ) = negl ( κ ) \begin{aligned}\left|\text{Pr}[\mathcal{A}\text{ wins}]-\frac{1}{2}\right|={\color{red}\left|\text{Pr}[\text{Succ}_1]-\text{Pr}[\text{Succ}_2]\right| \leq \textbf{Adv}_\text{DDH}(\kappa)}=\text{negl}(\kappa)\end{aligned} ∣ ∣ Pr [ A wins ] − 2 1 ∣ ∣ = ∣ Pr [ Succ 1 ] − Pr [ Succ 2 ] ∣ ≤ Adv DDH ( κ ) = negl ( κ ) 于是,我们可以写如下规约:
C ′ A ′ / C A ( G , q , g ) ← Gen ( 1 κ ) a , b , c ← Z q g 0 : = g c , g 1 : = g a b β ← { 0 , 1 } ⟶ ( G , q , g ) , g a , g b , g β p k : = ( ( G , q , g ) , g a ) ⟶ p k ⟵ m 0 , m 1 choose m 0 , m 1 γ ← { 0 , 1 } c : = ( g b , m γ g β ) ⟶ c ⟵ β ′ β ′ = 1 [ γ ′ = γ ] ⟵ γ ′ compute γ ′ \color{darkblue}\begin{matrix}\mathcal{C'} & & \mathcal{A'}/\mathcal{C} & & \mathcal{A}\\ (\mathbb{G},q,g)\leftarrow \text{Gen}(1^\kappa)\\a,b,c\leftarrow \mathbb{Z}_q \\g_0:=g^c,g_1:=g^{ab} \\ \beta \leftarrow \{0,1\} & \stackrel{(\mathbb{G},q,g),g^a,g^b,g_\beta}{\longrightarrow} &pk:=((\mathbb{G},q,g),g^a) & \stackrel{pk}{\longrightarrow} &\\ & & & \stackrel{m_0,m_1}{\longleftarrow}& \text{choose }m_0,m_1\\ & & \gamma\leftarrow\{0,1\}\\& & c:=(g^b,m_\gamma g_\beta) & \stackrel{c}{\longrightarrow} \\ & \stackrel{\beta'}{\longleftarrow}& \beta'=\mathbf{1}[\gamma'=\gamma]& \stackrel{\gamma'}{\longleftarrow} & \text{compute }\gamma'\end{matrix} C ′ ( G , q , g ) ← Gen ( 1 κ ) a , b , c ← Z q g 0 := g c , g 1 := g ab β ← { 0 , 1 } ⟶ ( G , q , g ) , g a , g b , g β ⟵ β ′ A ′ / C p k := (( G , q , g ) , g a ) γ ← { 0 , 1 } c := ( g b , m γ g β ) β ′ = 1 [ γ ′ = γ ] ⟶ p k ⟵ m 0 , m 1 ⟶ c ⟵ γ ′ A choose m 0 , m 1 compute γ ′ 当 β = 0 \beta=0 β = 0 时,模拟的正好是 Game 2;当 β = 1 \beta=1 β = 1 时,模拟的正好是 Game 1;因此
∣ Pr [ Succ 1 ] − Pr [ Succ 2 ] ∣ = ∣ Pr [ γ ′ = γ ∣ β = 1 ] − Pr [ γ ′ = γ ∣ β = 0 ] ∣ = ∣ Pr [ β ′ = 1 ∣ β = 1 ] − Pr [ β ′ = 1 ∣ β = 0 ] ∣ = Adv DDH , A ′ ( κ ) ≤ Adv DDH ( κ ) \begin{aligned}\left|\text{Pr}[\text{Succ}_1]-\text{Pr}[\text{Succ}_2]\right|&=\left|\text{Pr}[\gamma'=\gamma|\beta=1]-\text{Pr}[\gamma'=\gamma|\beta=0]\right|\\&=\left|\text{Pr}[\beta'=1|\beta=1]-\text{Pr}[\beta'=1|\beta=0]\right|\\ &=\textbf{Adv}_{\text{DDH},\mathcal{A}'}(\kappa) \\&\leq\textbf{Adv}_\text{DDH}(\kappa)\end{aligned} ∣ Pr [ Succ 1 ] − Pr [ Succ 2 ] ∣ = ∣ Pr [ γ ′ = γ ∣ β = 1 ] − Pr [ γ ′ = γ ∣ β = 0 ] ∣ = ∣ Pr [ β ′ = 1∣ β = 1 ] − Pr [ β ′ = 1∣ β = 0 ] ∣ = Adv DDH , A ′ ( κ ) ≤ Adv DDH ( κ ) GroupGen 初始化问题.
✅ Gen \text{Gen} Gen : 选择大素数 p , q p,q p , q 满足 q q q 有 κ \kappa κ 比特,且 q ∣ ( p − 1 ) q|(p-1) q ∣ ( p − 1 ) (一般可以令 q = 2 p + 1 q=2p+1 q = 2 p + 1 ,流程为:选择 q q q ,选好后判定 2 q + 1 2q+1 2 q + 1 是否是素数,不是则重来),那么 G \mathbb{G} G 是循环群 ( Z p ∗ , ⋅ ) (\mathbb{Z}_p^*,\cdot) ( Z p ∗ , ⋅ ) 的子群(且该循环群一定有 q q q 阶子群,选择 q q q 阶子群作为 G \mathbb{G} G ),然后令 g g g 为这个循环群的生成元。 ❌ Gen undefined \widetilde{\text{Gen}} Gen : 直接选择 G = ( Z q ∗ , ⋅ ) \mathbb{G}=(\mathbb{Z}_q^*,\cdot) G = ( Z q ∗ , ⋅ ) 作为循环群,其中 q q q 为 κ \kappa κ 比特的素数。 💡
如果用第二种方法生成群,则 ElGamal 不是 CPA 安全的 。我们可以构造敌手
A \mathcal{A} A :
C A ( p k , s k ) ← Gen undefined ( 1 κ ) p k : = ( ( G , q , g ) , y ) , s k : = x ⟶ p k ⟵ m 0 , m 1 choose m 0 ∈ Q N R q , m 1 ∈ Q R q b ← { 0 , 1 } r ← Z q c : = ( c 1 : = g r , c 2 : = m b y r = m b c 1 x ) ⟶ c A wins iff b ′ = b ⟵ b ′ b ′ ← Compute ( y , c 1 , c 2 ) \color{darkblue}\begin{matrix}\mathcal{C} & & \mathcal{A} \\ (pk,sk)\leftarrow\widetilde{\text{Gen}}(1^\kappa) \\ pk:=((\mathbb{G},q,g),y),sk:=x & \stackrel{pk}{\longrightarrow} \\ & \stackrel{m_0,m_1}{\longleftarrow} & \text{choose }m_0\in\mathbb{QNR}_q,m_1\in\mathbb{QR}_q \\ b\leftarrow\{0,1\} \\r\leftarrow\mathbb{Z}_q\\c:=(c_1:=g^r,c_2:=m_by^r=m_bc_1^x) & \stackrel{c}{\longrightarrow}\\ \mathcal{A}\text{ wins iff }b'=b & \stackrel{b'}{\longleftarrow}&b'\leftarrow\text{Compute}(y,c_1,c_2)\end{matrix} C ( p k , s k ) ← Gen ( 1 κ ) p k := (( G , q , g ) , y ) , s k := x b ← { 0 , 1 } r ← Z q c := ( c 1 := g r , c 2 := m b y r = m b c 1 x ) A wins iff b ′ = b ⟶ p k ⟵ m 0 , m 1 ⟶ c ⟵ b ′ A choose m 0 ∈ QNR q , m 1 ∈ QR q b ′ ← Compute ( y , c 1 , c 2 ) 其中,判定过程 Compute ( y , c 1 , c 2 ) \text{Compute}(y,c_1,c_2) Compute ( y , c 1 , c 2 ) 为:
若 y ∈ Q R q y\in\mathbb{QR}_q y ∈ QR q 或 c 1 ∈ Q R q c_1\in\mathbb{QR}_q c 1 ∈ QR q ,那么 y r = c 1 x = g x r ∈ Q R q y^r=c_1^x=g^{xr}\in\mathbb{QR}_q y r = c 1 x = g x r ∈ QR q ,因此 b = 1 ⇔ m b ∈ Q R q ⇔ c 2 ∈ Q R q b=1\Leftrightarrow m_b\in\mathbb{QR}_q \Leftrightarrow c_2\in\mathbb{QR}_q b = 1 ⇔ m b ∈ QR q ⇔ c 2 ∈ QR q 。即判断 c 2 ∈ Q R q c_2\in\mathbb{QR}_q c 2 ∈ QR q 是否成立,若成立返回 1,否则返回 0; 若 y , c 1 ∈ Q N R q y,c_1\in\mathbb{QNR}_q y , c 1 ∈ QNR q ,那么 y r = c 1 x = g x r ∈ Q N R q y^r=c_1^x=g^{xr}\in\mathbb{QNR}_q y r = c 1 x = g x r ∈ QNR q ,因此 b = 0 ⇔ m b ∈ Q R q ⇔ c 2 ∈ Q R q b=0\Leftrightarrow m_b\in\mathbb{QR}_q \Leftrightarrow c_2\in\mathbb{QR}_q b = 0 ⇔ m b ∈ QR q ⇔ c 2 ∈ QR q 。即判断 c 2 ∈ Q R q c_2\in\mathbb{QR}_q c 2 ∈ QR q 是否成立,若成立返回 0,否则返回 0。 那么,敌手 A \mathcal{A} A 赢的概率是 100%。
🔑
在这个循环群中,判断是否二次剩余只需要看
g t g^t g t 的系数
t t t 是否是奇数即可。
t t t 为奇数 ⟺ \Longleftrightarrow ⟺ g t ∈ Q N R q g^t\in\mathbb{QNR}_q g t ∈ QNR q ;t t t 为偶数 ⟺ g t ∈ Q R q \Longleftrightarrow g^t\in\mathbb{QR}_q ⟺ g t ∈ QR q ;那这是否和我们证明的 CPA 安全性相悖呢?
如果以 Gen undefined \widetilde{\text{Gen}} Gen 构造群,那么判断 ( g , g a , g b , T ) (g,g^a,g^b,T) ( g , g a , g b , T ) ,敌手只需要返回 1 [ T ∈ Q R q ] \mathbf{1}[T\in\mathbb{QR}_q] 1 [ T ∈ QR q ] 。对 DDH 问题中的 X \mathcal{X} X ,敌手返回 1 的概率是 1/2;对 Y \mathcal{Y} Y ,敌手返回 1 的概率是 3/4。也就是说,在这种情况下,
Adv DDH ≠ negl ( κ ) \textbf{Adv}_\text{DDH}\ne\text{negl}(\kappa) Adv DDH = negl ( κ ) 于是,自然这种情况下 ElGamal 也不是 CPA 安全的。
Decisional Composite Residuosity (DCR) .
N = p q = ( 2 p ′ + 1 ) ( 2 q ′ + 1 ) N=pq=(2p'+1)(2q'+1) N = pq = ( 2 p ′ + 1 ) ( 2 q ′ + 1 ) 且 p , q , p ′ , q ′ p,q,p',q' p , q , p ′ , q ′ 均为素数,其中 p ′ , q ′ p',q' p ′ , q ′ 长度为 κ \kappa κ 比特。 DCR 假设成立当且仅当对于任意 PPT 敌手 A \mathcal{A} A ,在 x ← Z N 2 ∗ , y ← Z N x\leftarrow\mathbb{Z}_{N^2}^*,y\leftarrow\mathbb{Z}_N x ← Z N 2 ∗ , y ← Z N 下有
Adv DCR , A ( κ ) = ∣ Pr [ A ( N , x N ) = 1 ] − Pr [ A ( N , x N ( 1 + N ) y ) = 1 ] ∣ = negl ( κ ) \textbf{Adv}_{\text{DCR},\mathcal{A}}(\kappa)=\left|\text{Pr}[\mathcal{A}(N,x^N)=1]-\text{Pr}[\mathcal{A}(N,x^N(1+N)^y)=1]\right|=\text{negl}(\kappa) Adv DCR , A ( κ ) = ∣ ∣ Pr [ A ( N , x N ) = 1 ] − Pr [ A ( N , x N ( 1 + N ) y ) = 1 ] ∣ ∣ = negl ( κ ) 该假设蕴含着
∣ Pr [ A ( N , x N ( 1 + N ) a , a , b ) = 1 ] − Pr [ A ( N , x N ( 1 + N ) b , a , b ) = 1 ] ∣ = negl ( κ ) \left|\text{Pr}[\mathcal{A}(N,x^N(1+N)^a,a,b)=1]-\text{Pr}[\mathcal{A}(N,x^N(1+N)^b,a,b)=1]\right|=\text{negl}(\kappa) ∣ ∣ Pr [ A ( N , x N ( 1 + N ) a , a , b ) = 1 ] − Pr [ A ( N , x N ( 1 + N ) b , a , b ) = 1 ] ∣ ∣ = negl ( κ ) Pallier 加密模式 (Pallier Encryption Scheme) .
Gen . ( N , p , q ) ← I G ( 1 κ ) ; λ ( N ) : = ( p − 1 ) ( q − 1 ) / 2 = 2 p ′ q ′ ; p k : = N , s k : = ( p k , λ ( N ) ) (N,p,q)\leftarrow\mathcal{IG}(1^\kappa);\lambda(N):=(p-1)(q-1)/2=2p'q';pk:=N,sk:=(pk,\lambda(N)) ( N , p , q ) ← I G ( 1 κ ) ; λ ( N ) := ( p − 1 ) ( q − 1 ) /2 = 2 p ′ q ′ ; p k := N , s k := ( p k , λ ( N )) ;返回 ( p k , s k ) (pk,sk) ( p k , s k ) 。Enc . M = Z N , r ← Z N , c : = ( 1 + N ) m r N mod N 2 \mathcal{M}=\mathbb{Z}_N,r\leftarrow\mathbb{Z}_N,c:=(1+N)^mr^N \text{ mod }N^2 M = Z N , r ← Z N , c := ( 1 + N ) m r N mod N 2 ;返回 c c c ;Dec . m ′ : = ( ( ( ( c λ ( N ) mod N 2 ) λ ( N ) − 1 mod N ) mod N 2 ) − 1 ) / N m':=((((c^{\lambda(N)}\text{ mod }N^2)^{\lambda(N)^{-1}\text{ mod }N})\text{ mod }N^2)-1)/N m ′ := (((( c λ ( N ) mod N 2 ) λ ( N ) − 1 mod N ) mod N 2 ) − 1 ) / N ;返回 m ′ m' m ′ .从 Enc 的过程可以看出,Pallier 的 CPA 安全性完全依赖于 DCR 假设 。
TODO: theoretical foundations of Pallier Encryption Scheme.