Digital Signature And Hash Function 密碼學與應用
海洋大學資訊工程系 丁培毅 丁培毅
1
Digital Signature And Hash Function - - PowerPoint PPT Presentation
Digital Signature And Hash Function 1 Electronic Signature Electronic Signature El Electronic Signature t i Si t Digital Signature Biometric Signature
1
ROC, 2002/04/01,
US Federal, 2000/06 Japan 2000/05
2
Japan, 2000/05
d
e (
3
The signature s in RSA signature scheme is required to satisfy
The signature in every digital signature scheme has to satisfy an
Given the signature s, it is easy to verify its validity. Gi
th d t it i diffi lt t f i t f th
Given the document m, it is difficult to forge a signature s for the
document m without the trapdoor information.
Eve’s attack #1: Given a pair of document and Alice’s signature (m, s)
wants to forge the signature of Alice for a second document m1 (m1, s) does not work, since m1 s e (mod n).
d l
e (
d ) f
The same tough problem as decrypting
needs to solve m1 s1e (mod n) for s1
Eve’s attack #2:
wants to forge the signature of Alice
problem as decrypting an RSA ciphertext.
4
wants to forge the signature of Alice chooses s1 first and calculate m1 s1e (mod n)
It is very unlikely that m1 will be meaningful.
almost always is meaningless
decompose the message: m m1ꞏ m2 (mod n)
almost always is meaningless
ask Alice to sign m1 and m2 independently and get
d (mod n) and s2 m2 d (mod n)
multiply the two signatures together to get
d ꞏ m2 d (m1m2)d md (mod n)
5
2 (
This is not easy if m is required to be plaintext
required to be plaintext.
Making Rabin signature
6
can avoid this attack. Never take square root directly!!
*
*, a secret integer a, and calculates a
select a secret random k such that gcd(k, p-1) = 1
k
r k (mod p) s k -1 (m - a r) (mod p-1)
compute v1 r r s (mod p) and v2 m (mod p)
7
signature is valid iff v1 v2 (mod p)
k+ r k s
r
Alice wants to sign a message ‘one’ i.e. m1 = 151405 She chooses p=225119, =11, a secret a=141421, a18191 (mod p) To sign the message, she chooses a random number k=239, r k164130,
e essage, s e c ooses a a do u be 39, 6 30, s1 k-1 (m1- a r) 130777 (mod p-1) …. (m1, r, s1) is the signature
Bob wants to verify if Alice signs the message m1 He calculates r r s1 128841*193273 173527 m1 173527 He calculates r 1 128841*193273 173527 ,
1 173527
Signature with Appendix
message can not be recovered from the signature message can not be recovered from the signature ElGamal, DSA
Message Recovery Scheme
i dil bt i d f th i t
8
message is readily obtained from the signature RSA, Rabin
given public , solving for a is a discrete log problem
r
fixed r, solving v2 r r s (mod p) for s is a discrete log problem fixed s, solving v2 r r s (mod p) for r is not proven to be as
it is not known whether there is a way to choose r and s it is not known whether there is a way to choose r and s
Bleichenbacher “Generating ElGamal signatures without Bleichenbacher, Generating ElGamal signatures without
forging ElGamal signature is sometimes easier than the
9
forging ElGamal signature is sometimes easier than the
10
Should not use the same random number k twice for two distinct
11
Alice wants to sign a second message ‘two’ i.e. m2 = 202315 She uses the same ElGamal parameters as before p=225119,
She signs this message with the same random number k=239, r
k 164130
E
Eve can compute (s1 - s2) k -34122 k m1 - m2 -50910 (mod
Since gcd( 34122 p 1) = 2 k has two solutions 239 or 112798 Since gcd(-34122, p-1) = 2, k has two solutions 239 or 112798 Because r k (mod p), Eve can verify easily that k = 239 k s m
12
k s1 m1 - a r (mod p-1) a = 28862 or 141421 a (mod p) a = 141421
Horster, Michels, and Petersen, “Meta-ElGamal Signature Schemes,” Tech.
Report TR-94-5, Univ. of Technology Chemnitz-Zwichau, 1994
6 t
6500+ i ti
6 types, 6500+ variations ex. Rearrange m, r, s of m a r + k s (mod p-1) as
A a B + k C (mod p-1) A a B + k C (mod p 1) verification equation A B r C (mod p) A B C m r s m a r + k s m r r s m s r m a s + k r m s r r k
s
r
m
s r m s a r + k m s r r m s m r s a m + k r s m r r r s m m a s + k m r s r m
13
r s m m a s + k m r r m s r a m + k s r m r s
14
D. Bleichenbacher, “Generating ElGamal Signatures Without
* is not as secure as it appears: known signatures
* or Zq *
15
p q
h' hꞏu rꞏu sꞏu (
16
efficient calculation of h(m)
given y = h(m), it is computationally infeasible to find a distinct
way
it is computationally infeasible to find two distinct messages m1
17
1
negligible
x x x x
h(ꞏ) given y, it is computationally infeasible to fi d h th t h( )
18
x
find any message m such that h(m) = y
19
D Ch
E H ij t B Pfit
“C
t hi ll St U d i bl
D. Chaum, E. van Heijst, B. Pfitzmann, “Cryptographically Strong Undeniable
Signatures Unconditionally Secure for the Signer”, Crypto’91
satisfies the second and the third requirements too slow to be used
select a prime number p, such that q=(p-1)/2 is also a prime
choose two random primitive roots , in Zp there exists unique a such that a (mod p), assume a is
hash function h : Zq2 Zp
here + ith 0
20
where m = x0 + x1 q with 0 x0, x1 q-1
21
d t
random tape
22
23
1 2
1)
2)
24
if the block algorithm is secure then the one-way hash function
Compression function
function
25
Not all 81 assignments of A, B, C are secure, the following 12
A B C mi hi-1 mi mi hi-1 hi-1 hi-1 mi hi-1 mi mi hi-1 hi-1 mi hi-1 mi mi hi-1 hi-1 m m h m h hi-1 hi-1 mi mi mi mi hi-1 mi hi-1 mi hi-1 mi hi-1
i 1
hi-1 hi-1
i
mi mi mi hi-1 mi hi-1
i i-1
26
hi-1 hi-1 mi mi mi hi-1 mi hi-1
27
the underlying signature algorithm guarantees that it is the underlying signature algorithm guarantees that it is
if h(m') = h(m) then sig(h(m')) will be sig(h(m))
28
29
30
31
32
33
2! e
2 3 3!
34
35
Receipt serial #12345678
... I, Fred, hereby owe you, Alice, 10000 dollars
dollars. … Fred 01/01/04
36
Receipt serial #12345678 Receipt serial #12345678
... I, Fred, hereby owe you, Alice,10000 dollars. ... I, Fred, hereby
you,Alice, 100 dollars. … Fred 01/01/04 … Fred 01/01/04
r = 230, n = 250, = r2 / n = 210 = 1024 Fred have r variations of {F }’s and r variations of {U }’s Fred have r variations of {Fi} s and r variations of {Ui} s Pr{ there is at least one match in h(Fi) and h(Ui) } 1 - e- 1
37
i*)
so that h(m') h(m)
In order to obtain another document that has the same hash
38
= 1 Pr{k i k -i (mod p)} 1
= 1, Pr{k, i, k i (mod p)} 1 - e = 0.632
39
1 repetition 2nd repetition 3rd repetition
40
1 2
2( 1( ))
step 1: calculate Ek(m) for all possible k step 1: calculate Ek(m) for all possible k step 2: calculate Dk(c) for all possible k step 3: compare the two lists there is at least one match
41
step 3: compare the two lists, there is at least one match
storage time tradeoff
42
43
for 232 random k1 for 232 random k2 calculate Ek1(m) for 2 random k1 for 2 random k2 calculate Dk2(c)
64
44
45
choose secret value a, 1 a q-1 and calculate a (mod p) public key (p q ) secret key a
46
public key (p, q, , ), secret key a
47
k (
u u
i
48
g()
49
1 2
50
51
52