Paillier加密方案

数论基础

Carmichael函数:\(n\in Z^+,\forall a\in Z_n^+\),若能满足\(a^x \equiv 1 (\mod n)\)的最小x,记为λ(n),称为Carmichael函数

定理:\(n\in Z^+\),设\(n=n_1·n_2\),且\((n_1,n_2)\)=1,则λ(n)=[λ(\(n_1\)),λ(\(n_2\))]

证明.
\(\forall a\in Z_n^+,a^{\lambda(n)} \equiv 1\mod n\)
\(\because n_1\mid n\)
\(\therefore a^{\lambda(n)} = 1\mod n_1\)
\(\therefore \lambda(n_1)\mid\lambda(n)\)
同理,\(\lambda(n_2)\mid\lambda(n)\)
\(\therefore [\lambda(n_1),\lambda(n_2)]\mid\lambda(n)\)
\(Z_{n_1}^+ = \lbrace a_i |0 < i \le n_1\rbrace,Z_{n_2}^+ = \lbrace b_j|0 < j \le n_2\rbrace\)
\(Z_n^+=\lbrace n_2a_i+n_1b_j \rbrace\)
\((n_2a_i+n_1b_j)^{\lambda(n_1)} \equiv n_2^{\lambda(n_1)} \equiv 1\mod n_1\)
\((n_2a_i+n_1b_j)^{[\lambda(n_1),\lambda(n_2)]}\equiv 1\mod n_1\)
同理,\((n_2a_i+n_1b_j)^{[\lambda(n_1),\lambda(n_2)]}\equiv 1\mod n_2\)
\(\because [n_1,n_2]=n\)
\(\therefore\forall a\in Z_n^+,a^{[\lambda(n_1),\lambda(n_2)]}\equiv 1\mod n\)
\(\therefore \lambda(n)\mid [\lambda(n_1),\lambda(n_2)]\)
\(\therefore [\lambda(n_1),\lambda(n_2)]=\lambda(n)\)

Carmichael函数的取值:

  • 当原根存在时,显然\(\lambda(n)=\varphi(n)\),即当n=\(2,4,p^{\alpha},2p^{\alpha}\)
  • 如果n = \(p_1^{a_1}·p_2^{a_2}\cdots p_s^{a_s}\),根据上面的定理,则λ(n) = [\(\lambda(p_1^{a_1}),\lambda(p_2^{a_2}),\cdots,\lambda(p_s^{a_s})\)]
  • 如果n = \(2^{\alpha},\alpha\ge 3\),则λ(n) = \(\frac{\varphi(n)}{2}\)

定理:\(n\in Z^+,w\in Z_n^+\),则\(w^{n\lambda(n)}\equiv 1\mod n^2\)

证明.
\(w^{\lambda(n)}\equiv 1\mod n\)
\(\therefore \exists k\in Z_N^+, w^{\lambda(n)} = 1+kn\)
\((w^{\lambda(n)})^n=(1+kn)^n=1+\Sigma_1^n C^i_n(kn)^i=1+kn^2+\Sigma_2^n C^i_n(kn)^i\equiv 1\mod n^2\)

Paillier加密方案

Paillier加密方案是欧洲通用的一种同态的公钥加密方案,其构造如下:

  • Gen:取两个大素数p,q,令n=pq,λ=[p-1,q-1],概率均匀的选择一个g\(\in Z^+_{n^2}\),并且满足 n | ord(g),则(n,g)为公钥,(p,q,λ)为私钥
  • Enc:对消息m\(\in Z^+_n\),概率均匀的选择一个r\(\in Z^+_n\),则密文 c = \(r^ng^m\mod n^2\)
  • Dec:解密m' = \(\frac{L(c^λ\mod n^2)}{L(g^λ\mod n^2)}\),其中L(x)=\(\frac{x-1}{n}\)

正确性验证:
因为\(g^{\lambda}\equiv 1\mod n\)
不妨令\(g^{\lambda}=1+kn,k\in Z^+\)

m' = \(\frac{\frac{c^{\lambda}-1}{n}}{\frac{g^{\lambda}-1}{n}}=\frac{\frac{(r^ng^m)^{\lambda}-1}{n}}{\frac{1+kn-1}{n}}\)

\(\equiv\frac{\frac{(g^{\lambda})^m-1}{n}}{k}\equiv\frac{\frac{(1+kn)^m-1}{n}}{k}\equiv\frac{\frac{1+mkn+\Sigma_2^mC_m^i(kn)^i-1}{n}}{k}\)

\(\equiv\frac{km}{k}\equiv m\mod n^2\)

posted @ 2019-12-26 00:06  2hYan9  阅读(1818)  评论(0编辑  收藏  举报