CIS 5371 Cryptography - FSU Computer Science

advertisement
CIS 5371 Cryptography
8. Data Integrity Techniques
1
Asymmetric techniques, I
Digital signatures
With PK encryption, Alice can use her private key
to decrypt a message and the resultant
“ciphertext’’ can be “encrypted’’ to recover the
message.
This ciphertext can serve as a
Manipulation Detection Code (MDC).
The verification of a MDC can be performed by
anyone since the public key is available to
anyone.
Example of an MDC based
on RSA
•
Let p = 101, q = 113. Then n = 11413.
ļŖ (n) = 100 ļ‚“ 112 = 11200 = 26527
•
Alice takes e = 3533, d = 6597
•
Alice publishes: n = 11413, e = 3533.
•
Let the message be m = 5761
•
Alice computes the MDC:
•
57616597 (mod 11413) = 9726
•
Suppose Bob wants to verify that 9726 is the MDC of Alice
•
Bob computes 97263533 mod 11413 = 5761
Digital signature schemes
•
M, message space
•
S, signature space
•
K, signing key space
•
K’, verifying key space
•
Gen: 1š‘› ļ‚® Kļ‚“K’, an efficient key generating algorithm
•
Sign: Mļ‚“K ļ‚® S, an efficient signing algorithm
•
Verify: Mļ‚“Sļ‚“K’ ļ‚®{true,false} an efficient verifying
algorithm.
The RSA signature scheme
Signature setup:
n = pq, where p and q are primes.
M = S = Zn , with keyspace
K = {(n,e,d) : ed = 1 mod ļŖ (n) }.
Public key = (n,e), Private key (n,d).
Signature generation: for m ļ„ Zn,
š‘  = š‘ š‘–š‘”š‘‘ š‘š = š‘šš‘‘ š‘šš‘œš‘‘ š‘›
Signature Verification
š‘‰š‘’š‘Ÿš‘–š‘“š‘¦
š‘›,š‘’
š‘š, š‘  = š‘‡š‘Ÿš‘¢š‘’ if and only if š‘  š‘’ = š‘š š‘šš‘œš‘‘ š‘›
Security issues for Digital
Signatures
Active attacks digital signatures
• Adaptive Chosen-Message Attack (CMA):
– The attacker chooses adaptively a number of messages and obtains
the corresponding signatures: the task of the attacker is successful
if he can sign a (new) target message.
• Existential forgery under CMA:
– The algorithms (Sign,Verify) form a one-way trapdoor pair. This
means that it is easy to compute valid “message-signature” pairs
(by first selecting a signature and then finding the corresponding
message).
– However, computing message-signature pairs should be hard.
– A usual way to control this is add redundancy to the message.
Rabin signatures
Signature setup: Same as RSA
Public key = (n,b), Private key = (p,q).
Signature generation: Exercise
Signature Verification: Exercise
The ElGamal signature scheme
Signature setup:
Same as ElGamal encryption scheme, with:
M = Zp* , S = Zp*ļ‚“ Zp-1, and keyspace K = Zp*ļ‚“ Zp-1.
Public key = (p, g, y)
Private key = (p, g, x).
The ElGamal signature scheme
•
Signing
Let m ļƒŽ Zp* be a message.
For public key (p,g,y), with y = gx modp,
and a secret random number k ļƒŽ Zp-1, define:
sigx,k (m,k) = (s,t), where
•
•
•
s = gk modp
t = (m-xs) k-1 mod (p-1)
Verification
Verify(p,,g,y)(m,(s,t)) = true ļƒ› st·ys = gm mod p.
Toy example
Let p = 467, g = 2, x = 127, y = 132
message m = 100,
Choose k = 213. Then k -1mod 466 = 431.
The signature is:
ļ¬
s = 2213 mod 467 = 29
ļ¬
t = (m-xs) k -1 mod (p-1)
= (100-127×29) 431 mod 466 = 51
Verification: 2100 ļ‚ŗ? 2951×13229 mod 467
The security of ElGamal
signatures
•
•
•
If the DL problem is feasible then ElGamal
signatures can be forged.
The converse may not be true.
The exponent k must be
•
•
•
private
cannot be used twice
best: chosen at random.
The Digital Signature Algorithm
Let p be a an L-bit prime prime,
512 ļ‚£ L ļ‚£ 1024 and L ļ‚ŗ 0 mod 64 ,
let q be a 160-bit prime that divides p-1 and
Let ļ” e Zp* be a q-th root of 1 modulo p.
Let M = Zp-1,
S = Zq x Zq and
K = {(p,q,ļ”,x,y): y = ļ” x modp }.
•
•
The public key is (p,q,ļ”,y).
The private key is (p,q,ļ”,x).
The Digital Signature scheme
•
Signing
Let m ļƒŽ Z be a message.
For public key (p,g,ļ”,y), with y = ļ” x mod p, and
secret random number k ļƒŽ Zp-1, define: sigx,k(m) = (s,t), where
•
s = (ļ” k mod p) mod q
•
t = (SHA(m) + xs) k -1 mod q
•
Verification
Let
• e1 = (SHA(m)) t -1 mod q
• e2 = s t -1 mod q
Verify(p,ļ”,y),(m,(s,t)) = true ļƒ› (ļ” e1 y e2 mod p) mod q = s.
Provable security
Forging signatures
•
•
•
•
We must how that given a message it is hard to forge a
signature. Is this enough?
There are several attacks we already discussed:
• Existential forgery
• Adaptive Chosen-Message Attacks
What is really needed is a formal security model for
digital signatures, that allows for all possible threat
scenarios and all protocol aspects.
One such model is the Random Oracle model.
Asymmetric techniques, II
Data Integrity without source Identification
Optimal Asymmetric Encryption Padding
RSA-OAEP
RSA with OAEP
Key Parameters
Let (N,e,d,G,H,n,k0,k1) ļƒŸU Gen (1x) satisfy:
ļ¶
(N,e,d) are RSA parameters
ļ¶
|N| = k = n+k0+k1, with 2k0, 2k1 negligible quantities
ļ¶
G, H hash functions with:
ļ‚§
G: {0,1}k0 ļ‚® {0,1}k-k0 , H: {0,1}k-k0 ļ‚® {0,1}k0
ļ¶
n is the length of the plaintext
ļ¶
(n, k0,k1,G,H,e) is Alice’s RSA public key,
ļ¶
(n, k0,k1,G,H,d) is Alice’s RSA private key.
RSA with OAEP
Encryption
Let m ļƒŽ {0,1}n be the message to be sent to Alice.
Bob (the adversary?) performs the following:
1.
.r ļƒŸ U {0,1}k0 ;
s ļƒŸ (m || 0k1) ļƒ… G(r) ; t ļƒŸ r ļƒ…H(s)
2.
.c ļƒŸ (s || t) e mod N
RSA with OAEP
Decryption
Upon receipt of the ciphertext c Alice performs:
1.
.s || t ļƒŸ c d mod N satisfying
|s| = n+k1 , |t| = k0
2.
.u ļƒŸ t ļƒ…H(s); v ļƒŸ s ļƒ… G(u)
3.
Output m if v = m || 0k0, else reject.
RSA with OAEP
Security
RSA with OAEP provides data-integrity, but not
origin integrity.
It can be shown that RSA-OAEP is secure against
adaptive chosen ciphertext (CCA2) attacks in the
Random Oracle Model.
The Random Oracle Model (ROM)
•
•
•
•
•
Security is defined in terms of a game involving two
parties: the system and the adversary.
All authorized parties of the system are represented by
random oracles (Alice, Bob, …)
Access to any party is via its oracle.
Access to an oracle G is by a query a, to get the
response G(a).
The system of oracles is managed by a Simulator (who
arranges that the oracles simulate the behavior of the
real parties).
The Random Oracle Model
•
There are two phases:
•
•
•
A training phase in which adversary is allowed to make
queries (adaptively) and get responses.
A test phase in which adversary must answer 0 or 1 as his
educated guess to a challenge.
The adversary wins if at the test phase he can distinguish
with probability better than
0.5 + negl
between two strings.
e.g. if a public-key encryption system is analyzed, the
adversary must distinguish between the ciphertexts c1,c2
of two new messages m1, m2.
The Random Oracle Model
•
•
The system is secure if the adversary cannot win.
The type of queries the adversary can make is
determined by the threat model used.
•
in CCA2 the adversary can adaptively chose
ciphertexts an get the corresponding plaintexts.
One-time signatures
Lamport signature scheme
Let k be an integer, P = {0,1}k.
Suppose that f : Y ļ‚® Z is a one-way function,
and A = Y k.
Let
ļ‚§ yi,j ļƒŽ Y be chosen at random, 1 ≤ i ≤ k, j =0,1, and
ļ‚§
zi,j = f (yi,j),
The key K consists of the 2k pairs : (yi,j, zi,j).
The y’s are the private key, the z’s are the pubic key.
Lamport signature scheme
ļ‚”
Signing
Let x = (x1,x2, … , xk) ļƒŽ P be a message.
For K = (yi,j, zi,j) define
sigK (x1,x2, … , xk) = (y1,x1,y2,x2, … , yk,xk ) .
ļ‚”
Verification
verK((x1,x2, … xk),(y1,x1,y2,x2, … , yk,xk )) = true
ļƒ› f(yi) = zixi , 1 ≤ i ≤ k
The security of the Lamport
signature scheme
The security of the Lamport signature scheme can
be proven if we assume that:
•
•
The one-way function is bijective, and that
The public key consists of distinct elements.
Certificates and Public-Key
Infrastructures
ļ‚§ We have not shown how to distribute
securely public keys.
ļ‚§ We shall now show how this can be done by
using public-key cryptography
ļ‚§ Sounds circular, and is! but works.
26
Certificates and Public-Key
Infrastructures
ļ‚§ A first approach: bootstrap all public-keys to a
single one using certificates.
ļ‚§ To be concrete suppose that Charlie has
generated a key pair (š‘š‘˜š¶ , š‘ š‘˜š¶ ).
ļ‚§ Consider the certificate
š‘š‘’š‘Ÿš‘”š¶→šµ = š‘ š‘–š‘”š‘ š‘˜š¶ ′šµš‘œš‘ ′ š‘  š‘˜š‘’š‘¦ š‘–š‘  š‘š‘˜šµ′
ļ‚§ Give this to Bob.
ļ‚§ Bob publishes: (š‘š‘˜š‘€ , š‘š‘’š‘Ÿš‘”š¶→šµ )
ļ‚§ This authenticates the public key of Bob to anyone
who trusts Charlie.
27
Download