Top Banner
CPSC415 Biometrics and Cryptography 1 Computer Computer Science Science Introduction to Public Key Cryptography Lecture 4
23

Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

Dec 24, 2015

Download

Documents

Vivien Randall
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 1

Computer Computer ScienceScience

Introduction to

Public Key Cryptography

Lecture 4

Page 2: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 2

Computer Computer ScienceScience

Outline

• Public Key Encryption

• Public Key Cryptographic System

• Public Key vs. Symmetric Key

• Digital Signatures

• Digital Envelope

Page 3: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 3

Computer Computer ScienceScience

Insufficiencies with Symmetric Encryption

• Symmetric encryption is not enough 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 that a received message really comes from the claimed sender?

Page 4: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 4

Computer Computer ScienceScience

Advent of Asymmetric Encryption

• Probably most significant advance in the 3000 year history of cryptography

• Use two keys: a public key and a private key

• Asymmetric since parties are not equal • Clever application of number theory

concepts instead of merely substitution and permutation

Page 5: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 5

Computer Computer ScienceScience

How Asymmetric Encryption Works

• Asymmetric encryption uses two keys that are related to each other – a public key, which may be known to anybody, is

used to encrypt messages, and verify signatures – a private key, known only to the owner, is used to

decrypt messages encrypted by the matching public key, and create signatures

– the key used to encrypt messages or verify signatures cannot decrypt messages or create signatures

Page 6: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 6

Computer Computer ScienceScience

Public key Encryption• Alice has a key pair: public and private

• publish the public key such that the key is publicly known• Alice keeps the private key secret

• Other people use Alice’s public key to encrypt messages for Alice

• Alice uses her private key to decrypt• Only Alice can decrypt since only Alice has the private key

Message Encrypt

Public key

Message Decrypt

Private key

• Trick: To compute the private key from the public key is a difficult problem.

Page 7: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 7

Computer Computer ScienceScience

Asymmetric Encryptionfor Confidentiality

Bob Alice

Page 8: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 8

Computer Computer ScienceScience

Asymmetric Encryptionfor Authentication

Bob Alice

Page 9: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 9

Computer Computer ScienceScience

Applications for Asymmetric Encryption

• Three categories– Encryption/decryption: sender encrypts a

message with receiver’s public key– Digital signature: sender “signs” a message

with its private key– Key exchange: two sides exchange a

session key

Page 10: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 10

Computer Computer ScienceScience

Security of Asymmetric Encryption

• Like symmetric schemes brute-force exhaustive search attack is always theoretically possible, but keys used are too large (>512bits)

• Not more secure than symmetric encryption, dependent on size of key

• Security relies on a large enough difference in difficulty between easy (en/decrypt) and hard (cryptanalyse) problems

• Generally the hard problem is known, just made too hard to do in practice

• Require using very large numbers, so is slow compared to symmetric schemes

Page 11: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 11

Computer Computer ScienceScience

Public key directory

encryption decryptionM

Alice’s public key

cryptanalysis Mprivate key

C MAlice

Eve

private key

Public key Cryptographic System

• C = EPK(M)

• M = DSK(C) = DSK(EPK(M))

• Public keys are published.• Each private key is known to the receiver only.• Difficult for Eve to find out SK from PK.

Page 12: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 12

Computer Computer ScienceScience

Public key vs. Symmetric key

Symmetric key Public key

Both share same key(or one key is computable from the other)

Typically faster Typically slower

Two parties MUST trust each other

Two parties DO NOT need to trust each other

Two separate keys: a public and a private key

Examples:DES, IDEA, RC5, CAST, AES, …

Examples:RSA, ElGamal Encryption, ECC…

Page 13: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 13

Computer Computer ScienceScience

Digital signatures

• Is there a functional equivalent to a handwritten signature?– Easy for legitimate user to sign– But hard for anyone else to forge– Easy for anyone to verify– Dependent on message & signer (key)

• Public key!– Sign: “invert” function using private key– Verify: compute function using public key

Page 14: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 14

Computer Computer ScienceScience

Digital signatures

Message Sign

Private key

Message

Verify

Public key

Valid/Invalid

(fixed-length signature)

• Only the signer (who has a private key) can generate a valid signature

• Everyone (since the corresponding public key is published) can verify if a signature with respect to a message is valid

Page 15: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 15

Computer Computer ScienceScience

Digital Envelopes-- Symmetric + Asymmetric

1. Generate a secret key (session key) at random.

2. Encrypt the message using the session key and symmetric algorithm.

3. Encrypt the session key with the recipient’s public key. This becomes the “digital envelope”.

4. Send the encrypted message and the digital envelope to the recipient.

• Figure …

Page 16: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 16

Computer Computer ScienceScience

Plain Cipher Cipher Plain

Session Key Session Key

Session KeySession Key

Recipient’s

Public key

Digital Envelope

Digital Envelope

Digital Envelopes

Page 17: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 17

Computer Computer ScienceScienceRSA

Page 18: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 18

Computer Computer ScienceScience

MotivationRevision• One problem with symmetric key algorithms is that

the sender needs a secure method of telling the receiver the key.

• Plus, you need a separate key for everyone you might communicate with.

• Public key algorithms use a public-key and private-key pair to tackle key management problem.– Each receiver has a public key pair.– The public key is publicly known (published).– A sender uses the receiver’s public key to encrypt a

message.– Only the receiver can decrypt it with the corresponding

private key.

Page 19: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 19

Computer Computer ScienceScienceRSA

• 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 – exponentiation takes O((log n)3) operations (easy)

• Use large integers (e.g. 1024 bits)• Security due to cost of factoring large numbers

– factorization takes O(e log n log log n) operations (hard)

Page 20: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 20

Computer Computer ScienceScienceRSA Key Setup

• Each user generates a public/private key pair by – select two large primes at random: p, q – compute their system modulus n=p·q

• note ø(n)=(p-1)(q-1) – select at random the encryption key e

• where 1<e<ø(n), gcd(e,ø(n))=1 – solve following equation to find decryption key d

• e·d=1 mod ø(n) and 0≤d≤n – publish their public encryption key: KU= {e,n} – keep secret private decryption key: KR= {d,n}

Page 21: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 21

Computer Computer ScienceScienceRSA Usage

• To encrypt a message M:– sender obtains public key of receiver KU={e,n} – computes: C=Me mod n, where 0≤M<n

• To decrypt the ciphertext C:– receiver uses its private key KR={d,n} – computes: M=Cd mod n

• Message M must be smaller than the modulus n (cut into blocks if needed)

Page 22: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 22

Computer Computer ScienceScience

RSA Example: Computing Keys

1. Select primes: p=17, q=112. Compute n=pq=17×11=1873. Compute ø(n)=(p–1)(q-1)=16×10=1604. Select e: gcd(e,160)=1 and e<160

choose e=7

5. Determine d: de=1 mod 160 and d<160 d=23 since 23×7=161=10×160+1

6. Publish public key KU={7,187}7. Keep secret private key KR={23,187}

Page 23: Computer Science CPSC415 Biometrics and Cryptography1 Introduction to Public Key Cryptography Lecture 4.

CPSC415 Biometrics and Cryptography 23

Computer Computer ScienceScience

RSA Example: Encryption and Decryption

• Given message M = 88 (88<187)

• Encryption KU={7,187} :C = 887 mod 187 = 11

• Decryption KR={23,187} :M = 1123 mod 187 = 88