Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 1
Communications security
Communications security
Lecturer: Andrea Baiocchi
DIET - University of Roma “La Sapienza” E-mail: [email protected]
URL: http://net.infocom.uniroma1.it/corsi/index.htm
University of Roma “Sapienza” DIET
Lecture 15
Digital signatures - Part II
[Sti02], Cap. 7, §§ 1-4 [Sta03], Cap. 13, §§ 1, 3 [KPS02], Cap. 6, § 8
About truth
About truth
and
and
lies
lies
…
…
Grande sorte è quella degli astrologi, che più fede gli dà una verità che pronosticano che non gli toglie cento falsità.
[Francesco Guicciardini]
La verità autentica è sempre inverosimile; per renderla più credibile bisogna assolutamente mescolarvi un po’ di menzogna.
[Fjodor Dostojevskij]
La verità è che la verità cambia.
[Friedrich Nietzsche]
Grande è la verità, ma ancora più grande, da un punto di vista pratico, è il silenzio sulla verità.
[Aldous Huxley]
Non sono sincero nemmeno quando dico che non sono sincero.
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 3
The elliptic curve DSA (ECDSA)
The elliptic curve DSA (ECDSA)
! US Govt approved (2000) signature scheme (FIPS 186-2)
! Uses the SHA-1 hash algorithm
! Designed by NIST & NSA
! Elliptic curve version of DSA
! Creates a 320-bit signature
! All the computations involve 160-bit (or slightly more) variables
(improved efficiency w.r.t. DSA)
! Security depends on difficulty of computing discrete logarithms
on finite elliptic curves
ECDSA key generation
ECDSA key generation
! Shared global public values (n, q, E, P)
An elliptic curve E defined over GF(n) where n is a prime or a power of 2
A 160-bit prime q and an element P!E of order q
(n, q, E, P) are such that the DL problem in the cyclic subgroup "P#$E
should be infeasible
Typical values of n are of the same order of q
! Each user generates his/her private key a and public key Q
Select a random integer a with 1 < a < q–1 Compute Q = aP
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 5
ECDSA signature creation
ECDSA signature creation
! Let P={0, 1}*, A= Zq *"Zq * and define
K={(n, q, E, P,a, Q) : Q = aP}
! To create the signature y = sigK (x) of a message x, the sender
Selects a random integer k with 1 ! k ! q–1
NOTE - k must be destroyed after use and never reused
Then computes the point kP = (u, v) ! GF(n)"GF(n)
The signature pair for x is (r, s) where
r = u mod q
s = (SHA-1(x) + ar)k–1 mod q
If r=0 or s=0, repeat the previous steps
! The signature y=(r, s) is sent with the message x
ECDSA signature verification
ECDSA signature verification
! To verify the signature y=(r, s) received with the message x , the
recipient computes
e1= s-1 SHA-1(x) mod q e2= s-1 r mod q
e1P+ e2Q = (u, v)
! If u mod q=r then verK(x, y) = true (signature is verified)
Proof e1P+ e2Q = e1P+ ae2P = kP
since e1+ ae2 % s-1 (SHA-1(x)+ ar) % s--1 ks % k mod q
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 7
ECDSA efficiency
ECDSA efficiency
! As in DSA, nearly all the calculations are performed mod q
! Only one calculation on E, i.e., in GF(n), is required on both
sides, replacing the DSA calculation mod p
For r in signing (it does not depend on x and can be pre-computed) For v in verifying
! Suitable (i.e., supposed to be secure) curves exist for n slightly
larger than 160 bits
Minimum size for the curves recommended in FIPS 186-2: 192 bits for p, 163 bits for a power of 2
! Elements of GF(n) have typical dimensions comparable to q
ECDSA
ECDSA
security
security
! The ECDSA security relies on the DL in the subgroup "P#$E ! Validation of global values (n, q, E, P) - Users should test that
n (if not a power of 2) is actually a prime of the required size q is actually a prime of the required size
P is actually on E and its order is actually q
E is not in any set of curves known to be weak
Otherwise, efficient attacks may exist
NOTE - Cautions in signature generation (k destroyed and never reused; r=0 and s =0 avoided) have the same security reasons holding in DSA
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 9
Zero
Zero
knowledge protocols
knowledge protocols
! We will introduce so called Zero knowledge authentication
procedures
Signatures can be derived from those schemes
Peggy
Prover, proves she knows a secret, without revealing anything about it.
Victor
Verifier, verifies Peggy knows the secret.
! Zero-knowledge property
Victor can simulate the execution of the authentication procedure and end up with the same information (in a statistical sense) as when interacting with Peggy.
Practical schemes
Practical schemes
! The Fiat-Shamir protocol is a first practical example of
zero-knowledge identity authentication scheme.
Based on public-key cryptography.
Commitment-challenge-answer paradigm.
Basic paradigm repeated k times, with increasing security as k grows.
! A conceptually similar scheme is Schnorr’s.
Based on discrete logarithm.
! More variants can be defined based on RSA, graph coloring,
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 11
Zero
Zero
knowledge proof concept
knowledge proof concept
Quisquater
Quisquater,
, Guillon
Guillon,
, Berson
Berson
! Victor stays in position A, while Peggy enters the tunnel.
! Once Peggy is inside, Victor moves to B and calls randomly
either “Left” or “Right” and expects Peggy to come out from the called side. left right Peggy Victor A B Locked door
(different keys on each side)
! Peggy proves she has
one of the two keys opening the door, yet Victor cannot know which one.
Fiat-Shamir parameter setting
Fiat-Shamir parameter setting
! Peggy randomly generates the two primes p and q, computes
the module n = pq
! Peggy chooses a random number s (1<s<n) and computes the
quantity v = s2 mod n
! Then Peggy can forget p, q and
publish (n,v) as her public authentication key; store s as her private authentication key.
! Security ultimately relies on belief that factoring n can be made
unfeasible
Efficient computation of square roots mod n can be proved to be equivalent to efficient factoring of n, i.e. if an efficient algorithm to compute square roots mod n is available, then n can be factored efficiently and viceversa.
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 13
Choose r (random)
Compute x = r2mod n
Compute y = rse mod n
Fiat-Fiat-Shamir protocol
Shamir protocol; single
; single run
run
Check y2 % xve mod n
e (challenge) Choose bit e (random) x (commitment)
y (answer) Choose r (random)
Compute x = r2mod n
Compute y = rse mod n
Choose bit e (random)
Check y2 % xve mod n
Fiat-Shamir protocol
Fiat-Shamir protocol
;
;
attack
attack
Compute y = r mod n Choose r (random) Choose random bit b Compute x = r2v–bmod n
e (challenge) x (commitment)
y (answer)
Success if b=e (probability 1/2) Check y
2 % xve mod n Choose bit e (random)
Choose bit e (random)
Check y2 % xve mod n
Choose r (random) Choose random bit b Compute x = r2v–bmod n
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 15
Fiat-Shamir with
Fiat-Shamir with
k
k
repetitions
repetitions
! If Oscar wants to impersonate Peggy, he can do the following:
choose a random r in Zn, a random bit b, compute x = r2v-bmod n and
send x to Victor;
If Victor’s challenge e=b, then just send r as the answer (check this!)
! Thus Oscar has 1/2 success probability on a single run
! After k independent challenges the success probability is 1/2k;
therefore, to prove her identity to Victor
Peggy chooses k random number r1,…,rk and she sends to Victor the quantities rj2 mod n, j=1,…,k;
Victor challenges Peggy by sending her k randomly chosen binary quantities ej, j=1,…,k;
Peggy returns to Victor the quantities yj = (sejr
j) mod n, j=1,…,k;
Victor checks that yj2 = (vejr
j2) mod n, j=1,…,k.
Why Fiat-Shamir protocol works
Why Fiat-Shamir protocol works
! In each run, Bob obtains triple (x,e,y), with y2=xve mod n and
x uniformly distributed over the nsq squares of Zn
e random bit with Pr(e=1)=P
y is uniformly distributed over Zn for any given secret key s
! He could have produced those quantities by himself with the
following efficient simulation
Choose a random square q=r2modn of Z
n and a random bit b with
Pr(b=1)=P.
Compute xs=qv–b modn, choose a random bit e with Pr(e=1)=P and let ys=r; if b=e, keep the triple, else erase it and go back to previous step
! Triple (xs,b,ys) has the same properties as triple (x,e,y) provided
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 17
From authentication to signature
From authentication to signature
! Essential to Fiat-Shamir protocol is Bob’s challenge; this needs
be adapted in case of non real time interaction (signature)
! Given a message m, Alice chooses her commitment (k random
squares xj=rj2 mod n, j=1,…,k), appends them to the message,
then computes a hash of the whole string.
! The resulting hash value is used as Bob surrogate.
Each bit is a challenge; answers are used as the message signature. Since Fred can search for a hash value such that he knows the answers to the resulting challenges, we need a larger margin than in real time interaction: this is easily provided by hash length, e.g. 128, 160 or 256 bit.
Fred sets xj=rj2v–bj mod n, j=1,…,& (& is the number of bits of the hash) and searches for m such that h(m||x1||x2||…||x&)=[b1b2…b&]2 (existential forgery)
Overhead can be substantial.
Schnorr
Schnorr
’
’
s scheme
s scheme
! Peggy chooses a prime p, a primitive root ' mod p, a random a,
1<a<p–2, computes (='a mod p and publishes {',(,p}
! Peggy chooses a random k, 1<k<p–1, computes ) = 'k mod p
and sends ) to Victor.
! Victor chooses a random r, 1<r<p–1, and sends it to Peggy
! Peggy computes y = k–ar (mod p–1) and sends y to Victor.
! Victor checks that ) = 'y(r mod p.
) and y are just random numbers; Victors learns nothing but those numbers.
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 19
Choose r (random)
Compute x = r2mod n
Compute y = rse mod n
Schnorr protocol
Schnorr protocol; single run
; single run
Check y2 % xve mod n
r (challenge)
Choose bit e (rando) ) (commitment)
y (answer) Choose k (random)
Compute ) = 'kmod p
Compute y = k–ar mod p
Choose random r, 1<r<p–1
Check ) = 'y(r mod p
Undeniable signatures
Undeniable signatures
! Principals are called signer and verifier; usual procedures are
Signature generation: by the signer
Signature verification: based on challenge-response
! A basic aim of such schemes is to involve actively signer into
signature verification, so that signed documents cannot be spread and checked out of signer control
! Then, the problem arises that the signer could cheat when
doing verification and make a valid signature result as a forgery; hence we need a third procedure
Disavowal protocol: based on challenge-response; it allows the verifier
to check his claim that the signature comes indeed from the signer and the signer to disavow a forged signature
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 21
Chaum-van Antwerpen scheme
Chaum-van Antwerpen scheme
! Let q and p=N·q+1 be primes; let '!Zp* be an element of order
q and let (='a mod p, with 1<a<q–1.
! Let G denote the subgroup of Zp* generated by ' and let h:
{0,1}**G; then P=A=G and K = {(p,',(,a), ' of order q, (='a
mod p}. Then, for K!K the signature y is generated as follows
y = (h(x))a mod p
! Verification is done as follows
Verifier chooses e1,e2!Zq* at random, computes c=ye1(e2 mod p (the
challenge) and sends to the signer.
Signer computes d=cz mod p, with z=a–1 mod q and sends it back
Verifier accepts y as a valide signature iff d=(h(x))e1'e2 mod p
Disavowal protocol
Disavowal protocol
1. Verifier chooses e1,e2!Zq* at random, computes c=ye1(e2 mod p
(the challenge) and sends to the signer.
2. Signer computes d=cz mod p, with z=a–1 mod q and sends it
back to the verifier.
3. Verifier checks that d" ( h(x))e1'e2 mod p.
4. Verifier chooses f1,f2!Zq* at random, computes C=yf1(f2 mod p
(the challenge) and sends to the signer.
5. Signer computes D=Cz mod p, with z=a–1 mod q and sends it
back to the verifier.
6. Verifier checks that D" ( h(x))f1'f2 mod p.
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 23
Scheme pictorial
Scheme pictorial
Computes h(x)
Choose bit e (random)
Generates e1,e2 in (1,q) Computes c = ye1(e2 modp Reads y Sends challenge c Sends reply d Check d=(h(x))e1'e2 modp
Choose bit e (random)
Generates f1,f2 in (1,q) Computes C = yf1(f2 modp Check D=(h(x))f1'f2 modp (x,y) is valid YES NO Sends challenge C Sends reply D (x,y) is valid YES NO Alice (d'–e2)f1=(D'–f2)e1 modp (x,y) is forged YES NO Alice is cheating
Properties
Properties
! P1 - If y" ( h(x))a mod p, then verifier will accept y as a valid
signature of the message x with probability 1/q.
This does not depend on any computational assumption, so security is unconditional
! P2 - if y" ( h(x))a mod p and verifier and signer follow the
disavowal protocol, then it is (d'–e2)f1=(D'–f2)e1 mod p.
This way signer can claim and show that a signature is forged.
! P3 - Suppose y=(h(x))a mod p and verifier follows the disavowal
protocol. If d" xe1'e2 mod p and D" xf1'f2 mod p, then the
probability that (d'–e2)f1" ( D'–f2)e1 mod p is 1–1/q.
This way verifier can give evidence that a denied signature is indeed genuine.
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 25
Games: flipping coins over the phone
Games: flipping coins over the phone
! A short “cryptological” story.
Alice and Bob live very far from each other; one day they have to decide who’ll take the beautiful house where they used to spend their summers as young guys. Bob phones Alice and says he’s going to flip a coin; Alice chooses Heads and Bob says “I’m sorry, it was Tails”. When Alice tells this story to Cindy, her local cryptologist, she suggests a better method could have been used…
! Alice chooses two large primes, p and q, computes n=pq and
sends n to Bob.
! Bob chooses a random x and sends y=x2 mod n to Alice.
! Alice computes the four square roots mod n of y, ±x and ±x’,
chooses one between x and x’ at random and sends it to Bob
! Bob wins if he can factor n by using the received root r and x.
Bob computes gcd(x–r,n); if r=x’, this yields either p or q.
Cautions
Cautions
! Bob has to verify that the received number gives y (mod n) once
squared
! Alice has no incentive in using n composed with more than two
prime factor, i.e. cheating on the fact that actually n be the product of two primes.
! The protocol assumes both Bob and Alice wish to win.
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 27
Bit commitment
Bit commitment
! Another short “cryptological” story
Alice runs an advanced research center and claims she has an algorithm to predict the winner of the Sunday horse race for sure. Bob is an addicted to betting at horse races and would love to try Alice’s method, so he asks Alice to prove her method by giving the forecast for next race. Alice replies she won’t disclose the results until Bob pays the predictor fully. So, they’re pretty much in a deadlock, until Cyrus, the local cryptologist, hears about this matter and suggests a method…
! Alice commits to one bit of information with Bob yet Bob cannot
learn that bit until proof time comes
! The bit b is set as the k-th most significant bit of a given binary
string S (otherwise chosen by Alice at will); Alice computes
H=h(S) and sends H to Bob
! When proof time comes, Alice sends S to Bob
To break commitment Alice should solve a collision problem with h(·)
A wrong scheme
A wrong scheme
! The bit b is set as the k-th most significant bit of a given binary
string S (otherwise chosen by Alice at will); Alice computes
C=EK(S) and sends C to Bob
! When proof time comes, Alice sends K to Bob, so that he can
compute S=DK(C) and check the k-th bit of S.
! Q. With this procedure, Alice can cheat. Why is that feasible?
A. Given C and bit b, Alice searches for two keys K and K’ such that the k-th bit of DK(C) is the complement of the k-th bit of D (C). This is easy, since bits change w.p. 1/2 when key is changed.
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 29
Dual signatures
Dual signatures
! Used in SET (Secure Electronic Transactions)
Started by MasterCard and Visa, 1996
! Three parties
Purchaser Merchant Bank
! Basic issue:
P does not want M to get his payment information (e.g. credit card credentials)
P does not want B to know what is being bought Yet payment should be tied to purchase order.
P
B M
Definitions
Definitions
! H = public hash function
! EX = public key encryption function of party X (X=P,M,B)
! DX = decryption function of party X (X=P,M,B)
! GSO = Goods and Services Order
Purchaser (cardholder) and merchant names Description of items/services being sold
! PI = Payment Instructions
Merchant’s name, price paid, details of payment Credit card data
Andrea Baiocchi, DIET, Università di Roma “Sapienza” - “Sicurezza nelle Comunicazioni” - A.A. 2013-2014 31
Protocol schematic
Protocol schematic
GSOMD=H(EM(GSO)) PIMD=H(EB(PI)) POMD=H(PIMD || GSOMD)
DS=DP(POMD)
DS, EB(PI), EM(GSO)
Check EP(DS) = H(H(EB(PI)) || H(EM(GSO))) If OK, get GSO=DM(EM(GSO))
Check EP(DS) = H(H(EB(PI)) || H(EM(GSO))) If OK, get PI=DB(EB(PI))
DS,
EB(PI),
EM(GSO)
EM(auth || DB(auth))