3. 傳統 ( 對稱性 ) 加密法之數位簽章需可信賴之第三者之助方得竟其功 . { 參考下圖 } Alice 與 Bob 沒有約定 session key, 兩人與 TTP 分別約定 session keys ka 及 kb , Bob 收到密文后直接轉給 TTP, 而 TTP 用與 Alice 約定之 session key 解得明文 , 再用與 Bob 約定之 session key 加密后 , 送給 Bob. TTP 3. C’ 1. C=E ka (M) 2. C M=D ka (C) C’=E kb (M) M=D kb (C’) TTP被完全信任?
4. RSA數位簽章 1. 本法乃為了確定送方身份而存在 . 2. 所謂簽章 , 就 RSA 而言只不過送方先用唯獨自己知道的私鑰 (private key) 加一次密之謂 . Alice 送出 C = (M d A mod m A ) e B mod m B 簽章 加密 Bob 解得 M = (C d B mod m B ) e A mod m A Alice Bob
5.
6. 方法簡介 : 選定 n=p*q; 其中 p 與 q 是大質數。令明文為 M ,密文為 C ,公開加密金匙為 (b,n) ,秘密解密金匙為 (p,q) 。 [ 加密程序 ]: C = M * (M + b) mod n , 其中 b 是亂數。 [ 解密程序 ]: 根據上式可知 M 2 + M*b - C = 0 mod n. 故明文可由下述四者之一算出 : M = -b/2 (b/2) 2 +C mod p M = -b/2 (b/2) 2 +C mod q
7. ElGamal 數位簽章 ElGamal 採 機率式 ; 即同一明文簽兩次會有相異簽署文 系統已知 簽署作業 驗證 大質數 P, mod P 之原根 g , 簽署者 B 任選之整數 ( 私鑰 ) x , 1<x<P-1 B 算出之公鑰 y = g x mod P { 用原根 g 以免被解 離散對數 } [ 此法之簽體 ( 即明文 M) 不能似 RSA 簽章法之可 直接還原 ] 對明文 M, 1 M P-1, B 選一整數 k, gcd(k, P-1) = 1, B 計算簽署文 (r, s) 滿足 : r = g k mod P, s = k -1 (M - x r) mod P-1( 或 M = x r + k s mod P-1). B 將 (r, s) 送給 A. 驗證者 A verifies 下式是否為真 ? g M = y r r s mod P g M = g x r g k s = y r r s mod P
8. 安全性分析 1. 若可由 y = g x mod P 中之 y 及 g 推算出 x , 則本法危矣 ! ( Discrete Logarithm Problem. ) 2. Intruder A’ 欲偽造 (r, s) 以滿足 g M = y r r s mod P 同樣面臨解 DLP. 3. Intruder A’ 若獲得明文 M 及其簽署 (r , s), 則因為 M = x r + k s mod P-1, 可知 想算出 x 及 k 兩未知數難矣 . 但若 B 利用相同的 k 簽署 M 1 與 M 2 而得 簽署文 (r , s 1 ) 及 (r , s 2 ) r = g k mod P, 則 聯立 M 1 = x r + k s 1 mod P-1 M 2 = x r + k s 2 mod P-1 而求解 x 與 k 易矣 ! 4.intruder 可偽造 M 之合法簽署 (r, s) ; 此 intruder 偽造簽署文 (r, s) 如下 : intruder 任選兩亂數 u and w, 1 < u, w < P-1 and gcd(w, P-1)=1, 計算 r = g u y -w mod P ………(1) s = r w -1 mod P-1 ………(2) 及 M = u s mod P-1 ………(3) { 注意 : M 無法由 intruder 事先自定 , 它是被算出的因變數 } 得 y r r s = y r (g u y -w ) s = y r g us y -ws = y r g us y -r = g us = g M mod P. 但 明文 M 無法由 intruder 事先自定 ; 即 M 可能是無意義的數字爾 ! 故此種 偽簽嚴格來看是 nonsense . 不過所有 DS 均有此攻擊法 , 而解決之道即引進單向赫序函數 ! {
9. 多數數位簽章法均有類似的攻擊法存在 , 若能使用 one-way hash function 合併之 , 則可高枕無憂矣 . 請參照後續之介紹 . Why One-way: (1) hash fun 對任意長度的明文 , 產生固定長度的密文 . (2) hash fun 對任意明文 M, 藉 HW/SW 易求得 h(M). 防攻擊 : (3) 對任意 hash fun 值 x, 計算上不可能藉 x=h(M) 求 M. (4) 對任一明文 M 1 , 要找另一明文 M 2 使得 h(M 1 ) =h(M 2 ) 在計算上不可行 . (5) 要找任一對 (M 1 ,M 2 ) 明文對 , 使得 h(M 1 ) =h(M 2 ) 在計算上不可行 . Unfortunately, although there are many functions that are believed to be one-way, there currently do not exist functions that can be proved to be one-way. Z m is defined to be the set {0, 1, . . . , m-1}, equipped with two operators, + and *. Addition and multiplication in Z m work exactly like real addition and multiplication, except that the results are reduced modulo m . 相信 f(x) = x b mod n, gcd(x, n)=1 是 one-way function. For a (finite) multiplicative group G, define the order of an element g G to be the smallest positive integer m such that g m = 1 .
14. Schnorr's DS {CRYPTO’89} 系統已知 簽署作業 驗證 1. 大質數 P 及 q 滿足 q|P-1, q 2 160 及 P 2 512 2. g Z p 且滿足 g q = 1 mod P, g 1 3. h 為 one-way hash fun. 4. Signer Bob 之私鑰 x , 1 < x < q 5. Bob 之公鑰 y = g x mod P. 1. Bob 任選一整數 k , 1 < k < q, 並求出 r = g k mod P 2. 求出 e = h(r, M) 3. 求出 s = k - x e mod q, (e, s) 即 Bob 對 M 之簽署文 . 驗證者 (Verifier) Alice 求出 : 1. r’ = g s y e mod P 2. 檢查 h(r’ , M) = e ? r’ = g s y e = g k-xe g xe = g k = r (mod P) h(r’ , M) = h(r , M) = e
15. Observations 1. 公鑰 y = g x mod P is precomputable, 故此法特別適用於 IC 卡上 . 2. 此法之簽署文較 ElGamal 為短 , 因為 e 的長度由 h 函數決定 , s 的長度小於 |q |. 3. Schnorr’s DS 中之 g ( > 2 160 ) 非 Z P 中之原根 ( 其序為 P-1) , 故安全不若 ElGamal’s DS. ElGamal-type Signatures ElGamal 簽章法乃以 DLP 為基 , 其 systematic design 詳情可見 於 “第八屆全國資訊安全會議論文集”之韓亮教授大作 pp. 1-16. 一般而言 , 除了 { r, s, M, k, x } 五參數外 , 尚有 one-way hash fun h 亦存在於簽章環境中 , 而簽署之對象是 h(M), 只是論文中已簡化成 M 矣 . 利用此五參數之排列組合 , 即可最少組合至 18 種簽章之多 , 當然此中有優劣之別 . 另 , since DSA is a special form of the original ElGamal scheme, which utilizes another parameter q, where q is a prime factor of P-1, all 18 ElGamal-type variants can be easily converted into DSA-type variants . 次頁簡介六種 DSA-type variants , 而其后再介紹 18 種 ElGamal-type variants.
17. ( 一 ) r r ’ = g s y m ? (mod p) 左 = ( g k ) r ’ = g k r ’ 右 = g s y m = g s (g x ) m = g s+xm = g k r ’ = 左
18. ElGamal-type variants 前提如 DSA-type form, 然而 此處 g , {r, s} is the digital signature of message m, k and x are secrets of the signer. In ElGamal original scheme, there are five parameters {r, s, m, k, x} in the signature signing equation. Although additional generalization and variants can generate more than 13,000 variants, but these 18 variants are the most efficient variants since each of them permutes these five parameters directly. 1. mx = rk + s mod p-1 y m = r r s mod p 2. mx = sk + r mod p-1 y m = r s r mod p 3. rx = mk + s mod p-1 y r = r m s mod p 驗證第一種 : mx = rk + s mod p-1 y m = r r s mod p 左 = y m = (g x ) m = g xm 右 = r r s = (g k ) r g s = g kr+s = g xm = 左
19. 4. rx = sk + m mod p-1 y r = r m s mod p 5. sx = rk + m mod p-1 y s = r r m mod p 6. sx = mk + r mod p-1 y s = r m r mod p 7. rmx = k + s mod p-1 y r m = r s mod p 8. x = mrk + s mod p-1 y = r mr s mod p 9. sx = k + mr mod p-1 y s = r mr mod p 10. x = sk + rm mod p-1 y = r s r m mod p 11. rmx = sk + 1 mod p-1 y r m = r s mod p 12. sx = rmk + 1 mod p-1 y s = r mr mod p 13. (r+m)x = k + s mod p-1 y r+m = r s mod p 14. x = (m+r)k + s mod p-1 y = r m+r s mod p 15. sx = k + (m+r) mod p-1 y s = r m+r mod p 16. x = sk + (r+m) mod p-1 y = r s m+r mod p 17. (r+m)x = sk + 1 mod p-1 y r+m = r s mod p 18. sx = (r+m)k + 1 mod p-1 y s = r m+r mod p
20. undeniable signature ( D. Chaum & H. van Antwerpen at CRYPTO’89) Known facts: a large prime P , and a primitive element g , are made public, and used by a group of signers. Alice has a private key, x , and a public key , g x . To sign a message, Alice computes z = M x . That’s all she needs to do. Verification is a litter more complicated: (B 要 A 印證 z 是她簽署的 ) (1) Bob chooses two random numbers, a and b, both less then P, and sends Alice: c = z a (g x ) b (mod P) (2) Alice computes x -1 (mod P-1), and sends Bob: d = c x -1 ( mod P) (3) Bob confirms that d M a g b (mod P) ( 此式子可馬上導證 ; 讀者自己試試看 ) If it is, he accepts the signature as genuine. 1. 此簽章法無法將還原明文 M. 2. 除了 signer Alice 外 , 無人知道其私鑰 x , 故不能否認簽署之事實 . 3. 下一方法是 D.Chaum 在 EUROCRYP90 所提之 zero-knowledge undeniable signature .
21. ( D. Chaum at EUROCRYPTO’90) ZKUS Known facts: a large prime P , and a primitive element g , are made public, and used by a group of signers. Alice has a private key, x , and a public key , g x . To sign a message, Alice computes z = M x . To verify a signature: (B 要 A 印證 [with Zero-Knowledge] z 是她簽署的 ) (1) Bob chooses two random numbers, a and b, both less then P, and sends Alice: c = M a g b (mod P) (2) Alice chooses a random number, q, less than P, and computes and sends to Bob: s 1 = cg q s 2 = ( cg q ) x ( mod P) (3) Bob sends Alice a and b, so that Alice can confirm that Bob did not cheat in step (1). (4) Alice sends Bob q, so that Bob can use M x and reconstructs s 1 and s 2 . If s 1 = cg q s 2 = ( g x ) b+q z a ( 此式子可馬上導證 ; 讀者自己試試看 ) If they are, he accepts the signature as genuine.
22. 數學式推導 d M a g b (mod P) ? ( 此式子可馬上導證 ): d = c x -1 = (z a (g x ) b ) x -1 = z a/x (g 1 ) b = M x(a/x) g b = M a g b (mod P) s 2 = ( cg q ) x = c x g xq = (M a g b ) x g xq = M ax g bx g xq = g xq+xb M ax = ( g x ) b+q z a s 2 = ( g x ) b+q z a ? ( 此式子可馬上導證 )
23.
24.
25. Nyberg-Rueppel Signature 系統已知 簽署作業 驗證 Let P be a large prime number, Q be a prime factor of P-1, and G be a primitive element to mod P.{ all these three are known to public}, Now, the signer holds SK [1, Q-1] as secret key and PK=G SK mod P as public key , plaintext M [1, P-1] and a random number r [1, Q-1] . SG 1 = M * G r mod P SG 2 = SK * SG 1 + r mod Q 任何人可用下列方式 驗證送方身份 並且可 recover message M : M G -SG 2 * PK SG 1 * SG 1 mod P G -SK*SG 1 -r * G SK * SG 1 * M * G r mod P M * G -SK*SG 1 -r + SK * SG 1 +r mod P ? 1994 年 Carmenisch, Piveteau & Stadler(CPS) 利用上述精神提出一盲簽章法
26.
27.
28. Blind Signature D. Chaum (1982) 系統參數 : signer 之 public key (e, n), private key d, p, q (n=p*q). 簽署程序 : A 請 B 簽署一份信息 M, 然 B 不被告知 M 之內容 (1) A 任選一亂數 r ( 即 blinding factor) , 1< r < n, 且計算 t = M * r e mod n , 給 B. (2) B 簽署 t, 即 = t d = (M* r e ) d mod n, 給 A. (3) A 計算 (unblind) 出 M 之簽章為 : s = * r -1 = t d * r -1 = M d (mod n). Think 1. r -1 如何求出 ? [ 根據下述探討知 必另有求反元素之方法 ] If gcd(a,n)=1, then how to compute x s.t. a*x mod n = 1? @ 只需將 x 設為 x = a (n)-1 mod n 即可 ! { 不必求 (n) ? } 2. 盲簽章應用於 digital money, electronic voting. 3. 即使 A 公佈了 M 與 s , B 也無法找出 (M, s) 與 (t, ) 之對應關係 ; 即 signer 無從追蹤明文 與當時盲簽章之相互關係 . 利用Euclid's algorithm.(所謂法二)
29. CPS blind-signature 系統參數 : signer holds SK [1, Q-1] as secret key and PK=G SK mod P as public key , and a random number r [1, Q-1] . signer requester K = G r mod P, r [1, Q-1] 任選兩亂數 ( 盲因子 ) , [1, Q-1] 算 SG 1 = M * G * K mod P C = SG 1 * -1 mod Q SG C = C * SK + r mod Q 算 SG 2 = SG C * + mod Q (4) 1 2 3 任何人可以下述驗證 M G -SG 2 * PK SG 1 * SG 1 mod P = (G -SG C * - ) * (G SK * SG 1 ) * ( M * G * K ) mod P = (G -( C *SK + r)* - ) * (G SK * SG 1 ) * ( M * G * G r * ) mod P = (G -SG 1 *SK -r * - ) * (G SK * SG 1 ) * ( M * G * G r * ) mod P = M * G -SG 1 *SK -r * - +SG 1 *SK +r * + mod P. ? (5)