Computer Security Lecture 5 Ch.9 Public-Key Cryptography And RSA Prepared by Dr. Lamiaa Elshenawy
Public-Key Cryptography And RSA Principles Of Public-Key Cryptosystems Public-Key Cryptosystems Applications for Public-Key Cryptosystems Requirements for Public-Key Cryptography Public-Key Cryptanalysis RSA Algorithm Description of the Algorithm Computational Aspects Security of RSA
Key Points Asymmetric encryption (Diffie and Hellman, 1976) Public Key (PUK) Private Key (PRK) Plaintext Encryption algorithm Decryption algorithm PUK/PRK Plaintext
Key Points Asymmetric encryption RSA most widely public-key cryptosystem confidentiality authentication
Principles Of Public Key Cryptosystem
Plaintext: readable message or data that is fed into the algorithm as input. Encryption algorithm: performs various transformations on plaintext. Public and private keys: a pair of keys selected, if one used for encryption, other used for decryption. Ciphertext: scrambled message. It depends on plaintext and the key, two different keys produce two different ciphertexts. Decryption algorithm: accepts ciphertext and key to produce the original plaintext.
Public-Key Cryptosystem: Secrecy
Public-Key cryptosystem: Authentication
Public-Key cryptosystem: Authentication and Secrecy
Applications for Public-Key Cryptosystems Encryption /decryption Digital signature Key exchange
Requirements for Public-Key Cryptography Easy computation B (public key, private key) Easy computation A (public key, M) Easy computation B (private key, C)
Requirements for Public-Key Cryptography Infeasible computationally adversary (public key) (private key) Infeasible computationally adversary (public key, C) (M) Order keys
Requirements for Public-Key Cryptography One way function Trap-door one-way function
Public-Key Cryptanalysis Use large keys tradeoff (brute-force attack, encryption/decryption) Public key private key (not proven mathematically)
RSA Algorithm Ron Rivest, Adi Shamir, and Len Adleman (Rivest-Shamir-Adleman) (RSA, 1977) block (binary value) < some number n. block size <= Log 2 (n) + 1 Sender and Receiver n Sender e Receiver d
RSA Algorithm
Requirements of RSA P and q are prime
RSA Algorithm
Public key: PU = {7, 187}, Private key: PR = {23, 187}. Let plaintext M= 88 For encryption, C = 88 7 mod 187
Encryption: RSA Algorithm mod 187 = [(88 4 mod 187) × (88 2 mod 187)× (88 1 mod 187)] mod mod 187 = mod 187 = 7744 mod 187 = mod 187 = 59,969,536 mod 187 = mod 187 = (88 × 77 × 132) mod 187 = 894,432 mod 187 = 11
Decryption: RSA Algorithm mod 187 = [(11 1 mod 187 ) × (11 2 mod 187 )× (11 4 mod 187 )] × (11 8 mod 187) × (11 8 mod 187)] mod mod 187 = mod 187 = mod 187 = 14,641 mod 187 = mod 187 = 214,358,881 mod 187 = mod 187 = (11 × 121 × 55 × 33 × 33) mod 187 = 79,720,245 mod 187 = 88 For decryption, M = mod 187
Example: RSA algorithm
Security of RSA 1.Brute force Trying all possible private keys Large key space 2. Mathematical attacks (n, Ø,d) large (n)
Security of RSA 3. Timing attacks: Depend on the running time of decryption algorithm Constant exponentiation time: Ensure that all exponentiations take the same amount of time Random delay: adding a random delay to the exponentiation algorithm Blinding: Multiply the ciphertext by a random number
Security of RSA
4. Chosen ciphertext attacks: Exploits properties of RSA algorithm optimal asymmetric encryption padding (OAEP)
Example 2 Let M=7 1.Select primes p=11, q=3 2.Calculate n = pq = 11 x 3 = 33 Ø = (p-1)(q-1) = 10 x 2 = 20 3.Choose e=3, Check gcd(e, Ø) =1 4.Compute d, ed ≡ 1 (mod Ø) or Ø divides (ed-1) or ed+Øk=1 Simple testing (d = 1, 2,...) Check: ed-1 = 3X7 - 1 = 20, which is divisible by Ø 5. Public key: PU = {n, e} = {33, 3} Private key: PR= {n, d} = {33, 7} 6. C = M e mod n = 7 3 mod 33 = 343 mod 33 = M= C d mod n =13 7 mod (4+2+1) = (13 4 x13 2 x13 1 ) mod 33 = (16 x 4 x 13 ) mod 33 = 832 mod 33= 7
Thank you for your attention