övning 10. ”diffie-hellman”-algoritmens funktionsprincip

advertisement
ÖVNING 10. ”DIFFIE-HELLMAN”-ALGORITMENS FUNKTIONSPRINCIP
Describe step by step all necessary calculations and actions needed by two computers
connected to the same network to agree - using both the original and the Elliptic Curve
Arithmetics based Diffie-Hellman Key Agreement Algorithm - on a shared secret
symmetric session key for encrypted data communication without sending this secret
session key between these two computers even in an encrypted form.
DEL A
Choose a prime p consisting of 3 digits and a positive integer alfa < p such that alfa is
primitive mod p - alfa is a generator.This means that all integer values {1,2,...,p-1} can
begenererated by (integer powers of alfa) modulo p.
For example, the integer 3 is primitive mod 7 since
31 mod 7 = 3
32 mod 7 = 2
33 mod 7 = 6
34 mod 7 = 4
35 mod 7 = 5
36 mod 7 = 1
The integer 2 is however not (primitive mod 7), since 21 mod 7 = 2, 22 mod 7 = 4, and 23
mod 7 = 1.
Also remember that if alfa(p-1)/q mod p = 1 for some prime factor q of p-1, then alfa is
NOT a generator.
p and alfa are public, but the positive random integers generated by both computers
independently of each other must be kept secret. In this exercise these
positive random integers can consist of 2 digits.
p = 157
alfa = 17
17mod157
17mod157 = 17
17^2mod157 = 132
17^3mod157 = 46
…
17^156mod157 = 1
156 = 12*13 = 3*2*2*13
17^156/13mod157 = 130
17^156/3mod157 = 12
17^156/2mod157 = 1
17 is NOT a generator
5^156/13mod157 = 130
5^156/3mod157 = 12
5^156/2mod157 = 156 => 5 is a generator
Computer1:
Lets use 157 and 5
Computer2:
OK
Computer1:
My private x is 7
Computer2:
My private y is 11
Computer1:
5^7mod157 = 96
Computer2:
5^11mod157 = 26
Computer1:
k = 26^7mod157 = 94
Computer2:
k = 96^11mod157 = 94
Both computers compute the same secret key k => OK
DEL B
Choose
· a Finite Field GF(pn), p>0 is a public prime and n>0 is a public integer
· an acceptable public Elliptic Curve E(pn)
· a public base point Gm on E(pn).
If you choose an acceptable Elliptic Curve E(23), then you can use animated Elliptic
Curve Arithmetics in the web based online tutorial on Elliptic Curve Arithmetic for
Elliptic Curves over Real Numbers and Elliptic Curves over Finite Fields in
My curve: y^2=x^3+5x+16 over 23
p = 23 a = 5 b = 16
(4*a^3+27*b^2)modp
(4*5^3 + 27*16^2)mod23 = (500 + 6912)mod23 = 6
It is an acceptable public Elliptic Curve
Computer1:
Lets use y^2=x^3+5x+16 over 23 on (4,10)
Computer2:
OK
Computer1:
My private x = 2
Computer2:
My private y = 5
Computer1:
2*(4,10) = (0,19)
Computer2:
5*(4,10) = 2*(0,19)+(4,10) = (18,21)+(4,10) = (13,1)
Computer1:
k = Xcoord(x*(y*G)) = Xcoord(2*(13,1)) = Xcoord(6,20) = 6
Computer2:
k = Xcoord(5*(0,19)) = Xcoord(2*(18,21)+(0,19)) = Xcoord(19,22)+(0,19) =
Xcoord(6,20) = 6
Both computers compute the same secret key k => OK
SAMULI KETOLA, MT4
17.12.2009
Download