170 likes | 357 Views
Public-Key Encryption and Digital Signatures. Stallings, Data and Computer Communications, 7th Edition, Pearson/Prentice-Hall. 21.4 Public-Key Encryption and Digital Signatures. 1976-Proposed by Diffie and Hellman Based on mathematical functions instead of simple operations on bit patterns.
E N D
Public-Key Encryption and Digital Signatures Stallings, Data and Computer Communications, 7th Edition, Pearson/Prentice-Hall
21.4 Public-Key Encryption and Digital Signatures • 1976-Proposed by Diffie and Hellman • Based on mathematical functions instead of simple operations on bit patterns. • Considered to be “asymmetric”, since two keys are used--one to encrypt and a second to decrypt. • In general, public key is not necessarily more secure than symmetric ciphers. • Security in general depends on key length and the computational work involved in breaker a cipher.
21.4 Public-Key Encryption and Digital Signatures (p.2) • Public-key Encryption (Fig. 21.9) • 1. Each end system generates a pair of keys. • 2. Each end system publishes its “public” encryption key. • 3. A sends B a message using B’s public key. • 4. B decrypts the message using B’s private key.
21.4 Public-Key Encryption and Digital Signatures (p.3) • Public-key Authentication (Fig. 21.7b) • 1.A sends B a message encrypted with A’s private key. • 2. B decrypts the message using A’s public key. • 3. Entire message acts as a digital signature, since only A could have encrypted the message.
21.4 Public-Key Encryption and Digital Signatures (p.4) • Digital Signatures • Instead of the entire message, a small block can be used. • This block, the authenticator, can then be encrypted using the sender’s private key. • This serves as a signature that verifies origin, content, and sequencing. • SHA-1 could serve as the authenticator.
21.4 Public-Key Encryption and Digital Signatures (p.5) • The RSA Public-Key Encryption Algorithm • The RSA algorithm (1977) is widely used for public-key encryption. • Developed by Ron Rivest, Adi Shamir, and Len Adleman (MIT). • It is a block cipher, with plaintext and cipher text represented as integers from 0 to n-1.
21.4 The RSA Algorithm • Encryption • Public Key is KU = {e,n}. • C = Me mod n, where M is the plaintext and C is the ciphertext (represented as integers). • Decryption • Private Key is KR = {d,n}. • M = Cd mod n.
21.4 Requirements for the RSA Algorithm • 1. It is possible to find values of e,d, and n such that Med = M mod n for all integers M < n. • 2. It is relatively easy to calculate Me and Cd for all values of M < n. • 3. It is infeasible to determine d given e and n.
21.4 RSA Algorithm Key Generation • 1. Select two different prime numbers, p and q. • 2. Calculate the product, n = p x q. • 3. Calculate the Euler totient. • (n) = (p - 1) x (q - 1). • 4. Select integer e. • gcd((n) ,e) = 1; 1 < e < (n)
21.4 RSA Algorithm Key Generation (p.2) • 5. Calculate d. • de = mod (n) = 1. • 6. Public Key is KU = {e,n}. • 7. Private Key is KR= {d,n}.
21.4 RSA Example • Key Generation Example • 1. Select primes, p = 17 and q = 11. • 2. Calculate n = p x q = 17 x 11 = 187. • 3. Calculate (n) = (17-1) x (11-1)= 160. • 4. Select e. • (n) = 32 x 5 = 25 x 5. • Possible e’s: 3,7,11,..., < (n) =160 • Choose 7.
21.4 RSA Example (p.2) • Key Generation Example (cont.) • 5. Determine d. • Solve (d x 7) mod 160 =1, where d < 160. • This means (d x 7) = (k x 160) + 1 for k an integer. • d = 23, since 23 x 7 = 161 = 10 x 160 +1. • 6. The Public Key is KU={7,187}. • 7. The Private Key is KR={23,187}.
21.4 RSA Example (p.3) • Encryption Example • Let M = 88. • C = 887 mod 187. • Now, consider the following property of modular arithmetic: • Xa+b mod n={(Xa mod n)(Xb mod n)}mod n. • C={(884mod187)(882mod187)(881mod187)}mod187 • C={132 x 77 x 88} mod 187 • C = 11.
21.4 RSA Example (p.4) • Decryption Example • Let C = 11. • M = 1123 mod 187. • M={(111mod187)(112mod187)(114mod187) (118mod187) (118mod187)}mod187 • M={11 x 121 x 55 x 33x 33} mod 187 • M = 88.
21.4 Attacks on RSA • Brute force--try all possible keys. • This means large keys need to be used, but implementations will have longer computation time. • Factor n, into its prime factors (p and q.) • For n large, this is a hard problem.