120 likes | 135 Vues
Learn about encryption algorithms and systems, including RSA encryption, symmetric vs asymmetric encryption, popular encryption algorithms such as DES, AES, and El Gamal, and hashing algorithms. Understand the process of generating public and private keys, and encrypting and decrypting messages using RSA.
E N D
Outline • NP-completeness & Encryption • Symmetric (secret key) vs Asymmetric (public key) Encryptions • Popular Encryption Algorithms • DES • AES • RSA Encryption • El Gamal Algorithms • Hashing Algorithms V. Sawma, Computer Security
RSA Encryption • 1978: Rivest, Shamir, Adelman • Public key encryption • Remains secure to date • Encryption key (e) and decryption key (d) are interchangeable. • The two keys, e and d, are carefully chosen such that • C = Pe mod n (encryption) and • P = Cd mod n (decryption). V. Sawma, Computer Security
Euler Totient Function • (n): the number of positive integers less than n and are relatively prime to n. • If n is prime: (n) = n – 1 • When n = p * q, where both p and q are primes and p q: (n) = (p) * (q) = (p – 1) * (q – 1) V. Sawma, Computer Security
RSA Encryption • Public key = (e, n) • Private key = (d, n) • Step 1: Choose n, p, & q n = p * q, where both p and q are primes and p q Example: n = 143 = p * q = 11 * 13 V. Sawma, Computer Security
RSA Encryption • Step 2: Choose e. e is relatively prime to (n). That is, e is relatively prime to (p-1)*(q-1). Example: e = 17, which is relatively prime to 10*12. • Step 3: Compute d. d is the inverse of e mod (p-1)*(q-1). Use the algorithm on page 81 to compute inverses. Note: A Java implementation of the algorithm is available at the class page. Example: d = e-1 mod (p-1)*(q-1) = 17-1 mod 120= 113 V. Sawma, Computer Security
RSA Encryption • An example: P = 7 Let n = 143, p = 11, q = 13, and e = 11. Note: e is relprime to (p-1)*(q-1). Then d = 11 Note: d is the inverse of e mod (p-1)*(q-1). Encryption: C = Pe mod n = 711 mod 143 = 106 Decryption: P = Cd mod n = 10611 mod 143 = 7 V. Sawma, Computer Security
RSA Encryption • Another example: P = 7 Let n = 143, p = 11, q = 13, and e = 17. Note: e is relprime to (p-1)*(q-1). Then d = 113 Note: d is the inverse of e mod (p-1)*(q-1). Encryption: C = Pe mod n = 717 mod 143 = 50 Decryption: P = Cd mod n = 50113 mod 143 = 7 V. Sawma, Computer Security
RSA Encryption • Still another example: P = 55 Let n = 285, p = 19, q = 17, and e = 37. Note: e is relprime to (p-1)*(q-1), 288. d = 109 Note: d is the inverse of e mod (p-1)*(q-1). Encryption: C = Pe mod n = 5537 mod 288 = 55 Decryption: P = Cd mod n = 55109 mod 288 = 55 V. Sawma, Computer Security
RSA Encryption • The cryptographer’s job: • Find three primes, p, q, and e, where p * q = n and e is relatively prime to (p-1)*(q-1). • Compute d based on e and n. The challenge: p, q, and e must be large enough primes. V. Sawma, Computer Security
RSA Encryption • The cryptanalyst’s job: P = Cd mod n • Available: (e, n). • Find two primes p and q, such that p * q = n and e is relatively prime to (p-1)*(q-1). • Compute d: d = inverse (e, (p-1)*(q-1)) Q: Where’s the secrecy? Q: Given n and a prime e, how hard is it to find two distinct primes, p and q, such that p*q = n and (p-1)*(q-1) is relprime to e? V. Sawma, Computer Security
Example Using RSA Example: Plain Text P = N O W || ASCII Text P = 78 79 87 p = 13, q = 17 n = p x q = 221 e = relprime to (p-1)(q-1) = relprime to 192 = 19 d = inverse of e mod (p-1)(q-1) = inverse of 19 mod 192 = 19^(190) mod 192 = 91 Encryption: P^e mod n N: 78 ^ 19 mod 221: 65 O: 79 ^ 19 mod 221: 209 W: 87 ^ 19 mod 221: 178 Decryption: P = C^d mod n 65 ^ 91 mod 221: 78 => N 209: ^ 91 mod 221: 79 => O 178: ^ 91 mod 221: 87 => W V. Sawma, Computer Security