1 Public-Key Cryptography and Message Authentication.

20
1 Public-Key Public-Key Cryptography and Cryptography and Message Message Authentication Authentication

Transcript of 1 Public-Key Cryptography and Message Authentication.

Page 1: 1 Public-Key Cryptography and Message Authentication.

1

Public-Key Public-Key Cryptography and Cryptography and

Message Message AuthenticationAuthentication

Page 2: 1 Public-Key Cryptography and Message Authentication.

2

Public-Key Public-Key Cryptography Cryptography

PrinciplesPrinciples• The scheme has six ingredients

– Plaintext– Encryption algorithm– Public and private key– Ciphertext– Decryption algorithm

Page 3: 1 Public-Key Cryptography and Message Authentication.

3

Encryption using Encryption using Public-Key systemPublic-Key system

Page 4: 1 Public-Key Cryptography and Message Authentication.

4

Requirements for Requirements for Public-Key Public-Key

CryptographyCryptography1. Computationally easy for a party B to generate a

pair (public key KUb, private key KRb)

2. Easy for sender to generate ciphertext:

3. Easy for the receiver to decrypt ciphertext using private key:

)(MEC KUb

)]([)( MEDCDM KUbKRbKRb

Page 5: 1 Public-Key Cryptography and Message Authentication.

5

Requirements for Requirements for Public-Key Public-Key

CryptographyCryptography4. Computationally infeasible to determine private key

(KRb) knowing public key (KUb)

5. Computationally infeasible to recover message M, knowing KUb and ciphertext C

6. Either of the two keys can be used for encryption, with the other used for decryption:

)]([)]([ MEDMEDM KRbKUbKUbKRb

Page 6: 1 Public-Key Cryptography and Message Authentication.

6

Public-Key Public-Key Cryptographic Cryptographic

AlgorithmsAlgorithms• RSA and Diffie-Hellman - Stanford• RSA - Ron Rivest, Adi Shamir and Len Adleman at

MIT, in 1977.– RSA is a block cipher– The most widely implemented

• Diffie-Hellman – Echange a secret key securely– Compute discrete logarithms

Page 7: 1 Public-Key Cryptography and Message Authentication.

7

Private-Key Private-Key CryptographyCryptography

• Traditional private/secret/single-key cryptography uses one key

• Shared by both sender and receiver • If this key is disclosed communications are

compromised • Also is symmetric, parties are equal

Page 8: 1 Public-Key Cryptography and Message Authentication.

8

Public-Key Public-Key CryptographyCryptography

• Public-key/two-key/asymmetric cryptography involves the use of two keys: – A public-key, which may be known by anybody,

and can be used to encrypt messages, and verify signatures

– A private-key, known only to the recipient, used to decrypt messages, and sign (create) signatures

• Is asymmetric because– Those who encrypt messages or verify signatures

cannot decrypt messages or create signatures

Page 9: 1 Public-Key Cryptography and Message Authentication.

9

Why Public-Key Why Public-Key Cryptography?Cryptography?

• Developed to address two key issues:– Key distribution – how to have secure

communications in general without having to trust a KDC with your key

– Digital signatures – how to verify a message comes intact from the claimed sender

Page 10: 1 Public-Key Cryptography and Message Authentication.

10

Public-Key Public-Key CharacteristicsCharacteristics

• Public-key algorithms rely on two keys with the characteristics that it is:– Computationally infeasible to find decryption key

knowing only algorithm & encryption key– Computationally easy to en/decrypt messages

when the relevant (en/decrypt) key is known– Either of the two related keys can be used for

encryption, with the other used for decryption (in some schemes)

Page 11: 1 Public-Key Cryptography and Message Authentication.

11

Public-Key Public-Key CryptosystemsCryptosystems

Page 12: 1 Public-Key Cryptography and Message Authentication.

12

Security of Public Key Security of Public Key SchemesSchemes

• Like private key schemes brute force exhaustive search attack is always theoretically possible

• But keys used are too large (>512bits) • Security relies on a large enough difference in difficulty

between easy (en/decrypt) and hard (cryptanalyse) problems

• Requires the use of very large numbers• Hence is slow compared to private key schemes

Page 13: 1 Public-Key Cryptography and Message Authentication.

13

Page 14: 1 Public-Key Cryptography and Message Authentication.

14

RSARSA• By rivest, shamir & adleman of MIT in 1977 • Best known & widely used public-key scheme • Based on exponentiation in a finite field over integers

modulo a prime – Exponentiation takes o((log n)3) operations (easy)

• Uses large integers (eg. 1024 bits)• Security due to cost of factoring large numbers

Page 15: 1 Public-Key Cryptography and Message Authentication.

RSA RSA Encryption/DecryptionEncryption/Decryption

• public key (e,n)Encryption• convert message to number• compute C = Me mod n• convert C back to text

15

Page 16: 1 Public-Key Cryptography and Message Authentication.

RSA RSA Encryption/DecryptionEncryption/Decryption

• private key (d,n)Decryption• onvert ciphertext to number• compute M = Cd mod n• convert M back to text• require M < n

16

Page 17: 1 Public-Key Cryptography and Message Authentication.

17

RSA Key SetupRSA Key Setup

• pick two large prime numbers p and q• let n = pq• pick another number e such that e is

relatively prime to (p-1)(q-1) known as ø(n)

• compute d such thated mod (p-1)(q-1) = 1

• the pair (e,n) is the public key• the pair (d,n) is the private key

Page 18: 1 Public-Key Cryptography and Message Authentication.

18

RSA UseRSA Use

• To encrypt a message M the sender:– Obtains public key of recipient ku={e,n} – Computes: c=me mod N, where 0≤M<N

• To decrypt the ciphertext C the owner:– Uses their private key kr={d,p,q} – Computes: m=cd mod N

• Note that the message M must be smaller than the modulus N (block if needed)

Page 19: 1 Public-Key Cryptography and Message Authentication.

19

RSA ExampleRSA Example1. Select primes: p=17 & q=112. Compute n = pq =17×11=1873. Compute ø(n)=(p–1)(q-1)=16×10=1604. Select e : choose e=75. Determine d: 1 = de mod 160 and d < 160

value is d=23 since 23×7=161= 1×160+16. Publish public key KU={7,187}7. Keep secret private key KR={23,17,11}

Page 20: 1 Public-Key Cryptography and Message Authentication.

20

RSA Example contRSA Example cont

• Sample RSA encryption/decryption is: • Given message M = 88 • Encryption:

C = 887 mod 187 = 11 • Decryption:

M = 1123 mod 187 = 88