74f648c725068ad0ca95037cdfacb520.ppt
- Количество слайдов: 25
CSCE 715: Network Systems Security Chin-Tser Huang huangct@cse. sc. edu University of South Carolina 02/04/2009
RSA n n n Invented by Rivest, Shamir & Adleman of MIT in 1977 Best known and widely used public-key scheme Based on exponentiation in a finite (Galois) field over integers modulo a prime 3 n exponentiation takes O((log n) ) operations (easy) Use large integers (e. g. 1024 bits) Security due to cost of factoring large numbers log n) operations n factorization takes O(e (hard) 02/04/2009 2
RSA Key Setup n Each user generates a public/private key pair by n n n select two large primes at random: p, q compute their system modulus n=p·q n note ø(n)=(p-1)(q-1) select at random the encryption key e n n where 1
RSA Usage n To encrypt a message M: n n n To decrypt the ciphertext C: n n n sender obtains public key of receiver KU={e, n} computes: C=Me mod n, where 0≤M
Why RSA Works n n Euler's Theorem: aø(n) mod n = 1 where gcd(a, n)=1 In RSA, we have n n n=p·q ø(n)=(p-1)(q-1) carefully chosen e and d to be inverses mod ø(n) hence e·d=1+k·ø(n) for some k Hence : Cd = (Me)d = M 1+k·ø(n) = M 1·(Mø(n))k = M 1·(1)k = M 1 = M mod n 02/04/2009 5
RSA Example: Computing Keys Select primes: p=17, q=11 Compute n=pq=17× 11=187 Compute ø(n)=(p– 1)(q-1)=16× 10=160 Select e: gcd(e, 160)=1 and e<160 1. 2. 3. 4. choose e=7 § Determine d: de=1 mod 160 and d<160 5. d=23 since 23× 7=161=1× 160+1 § 6. 7. Publish public key KU={7, 187} Keep secret private key KR={23, 187} 02/04/2009 6
RSA Example: Encryption and Decryption n Given message M = 88 (88<187) n Encryption: C = 887 mod 187 = 11 n Decryption: M = 1123 mod 187 = 88 02/04/2009 7
Exponentiation n Use a property of modular arithmetic [(a mod n) (b mod n)]mod n = (a b)mod n n Use the Square and Multiply Algorithm to multiply the ones that are needed to compute the result Look at binary representation of exponent Only take O(log 2 n) multiples for number n n n e. g. 75 = 74· 71 = 3· 7 = 10 (mod 11) e. g. 3129 = 3128· 31 = 5· 3 = 4 (mod 11) 02/04/2009 8
RSA Key Generation n Users of RSA must: n n n Primes p, q must not be easily derived from modulus n=p·q n n n determine two primes at random - p, q select either e or d and compute the other means p, q must be sufficiently large typically guess and use probabilistic test Exponents e, d are multiplicative inverses, so use Inverse algorithm to compute the other 02/04/2009 9
Security of RSA n Four approaches to attacking RSA n n brute force key search (infeasible given size of numbers) mathematical attacks (based on difficulty of computing ø(n), by factoring modulus n) timing attacks (on running of decryption) chosen ciphertext attacks (given properties of RSA) 02/04/2009 10
Factoring Problem n Mathematical approach takes 3 forms: n n factor n=p·q, hence find ø(n) and then d determine ø(n) directly and find d directly Currently believe all equivalent to factoring n have seen slow improvements over the years n n biggest improvement comes from improved algorithm n n as of May-05 best is 200 decimal digits (663 bits) with LS cf “Quadratic Sieve” to “Generalized Number Field Sieve” to “Lattice Sieve” 1024+ bit RSA is secure barring dramatic breakthrough n 02/04/2009 ensure p, q of similar size and matching other constraints 11
Timing Attacks n n Developed in mid-1990’s Exploit timing variations in operations n n e. g. multiplying by small vs large number Infer operand size based on time taken RSA exploits time taken in exponentiation Countermeasures n n n use constant exponentiation time add random delays blind values used in calculations 02/04/2009 12
Chosen Ciphertext Attacks n n n RSA is vulnerable to a Chosen Ciphertext Attack (CCA) attackers chooses ciphertexts and gets decrypted plaintext back choose ciphertext to exploit properties of RSA to provide info to help cryptanalysis can counter with random pad of plaintext or use Optimal Asymmetric Encryption Padding (OAEP) 02/04/2009 13
Key Management n n Asymmetric encryption helps address key distribution problems Two aspects n n distribution of public keys use of public-key encryption to distribute secret keys 02/04/2009 14
Distribution of Public Keys n Four alternatives of public key distribution n n Public announcement Publicly available directory Public-key authority Public-key certificates 02/04/2009 15
Public Announcement n Users distribute public keys to recipients or broadcast to community at large n n E. g. append PGP keys to email messages or post to news groups or email list Major weakness is forgery n n anyone can create a key claiming to be someone else’s and broadcast it can masquerade as claimed user before forgery is discovered 02/04/2009 16
Publicly Available Directory n n Achieve greater security by registering keys with a public directory Directory must be trusted with properties: n n n contains {name, public-key} entries participants register securely with directory participants can replace key at any time directory is periodically published directory can be accessed electronically Still vulnerable to tampering or forgery 02/04/2009 17
Public-Key Authority n n Improve security by tightening control over distribution of keys from directory Has properties of directory Require users to know public key for the directory Users can interact with directory to obtain any desired public key securely n require real-time access to directory when keys are needed 02/04/2009 18
Public-Key Authority 02/04/2009 19
Public-Key Certificates n n Certificates allow key exchange without realtime access to public-key authority A certificate binds identity to public key n n n usually with other info such as period of validity, authorized rights, etc With all contents signed by a trusted Public. Key or Certificate Authority (CA) Can be verified by anyone who knows the CA’s public key 02/04/2009 20
Public-Key Certificates 02/04/2009 21
Distribute Secret Keys Using Asymmetric Encryption n n Can use previous methods to obtain public key of other party Although public key can be used for confidentiality or authentication, asymmetric encryption algorithms are too slow So usually want to use symmetric encryption to protect message contents Can use asymmetric encryption to set up a session key 02/04/2009 22
Simple Secret Key Distribution n Proposed by Merkle in 1979 n n A generates a new temporary public key pair A sends B the public key and A’s identity B generates a session key Ks and sends encrypted Ks (using A’s public key) to A A decrypts message to recover Ks and both use 02/04/2009 23
Problem with Simple Secret Key Distribution n An adversary can intercept and impersonate both parties of protocol n n n A generates a new temporary public key pair {KUa, KRa} and sends KUa || IDa to B Adversary E intercepts this message and sends KUe || IDa to B B generates a session key Ks and sends encrypted Ks (using E’s public key) E intercepts message, recovers Ks and sends encrypted Ks (using A’s public key) to A A decrypts message to recover Ks and both A and B unaware of existence of E 02/04/2009 24
Next Class n n Key exchange Diffie-Hellman key exchange protocol Elliptic curve cryptography Read Chapters 11 and 12 02/04/2009 25


