Top Banner
Cryptography & digital signature Cryptography & digital signature Dec. 2013 Dec. 2013 Ref: http://cis.poly.edu/~ross/
27

Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

Oct 07, 2020

Download

Documents

dariahiddleston
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: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

Cryptography & digital signature Cryptography & digital signature

Dec. 2013Dec. 2013

Ref: http://cis.poly.edu/~ross/

Page 2: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

2

2

Cryptography Cryptography • Overview

– Symmetric Key Cryptography– Public Key Cryptography– Message integrity and digital signatures

References:StallingsKurose and Ross

Network Security: Private Communication in a Public World, Kaufman, Perlman, SpecinerSlides:http://cis.poly.edu/~ross/

• Overview– Symmetric Key Cryptography– Public Key Cryptography– Message integrity and digital signatures

References:StallingsKurose and Ross

Network Security: Private Communication in a Public World, Kaufman, Perlman, SpecinerSlides:http://cis.poly.edu/~ross/

Page 3: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

3

3

Cryptography issuesCryptography issuesConfidentiality: only sender, intended receiver should “understand” message contents

– sender encrypts message– receiver decrypts message

End-Point Authentication: sender, receiver want to confirm identity of each other Message Integrity: sender, receiver want to ensure message not altered (in transit, or afterwards) without detection

Confidentiality: only sender, intended receiver should “understand” message contents– sender encrypts message– receiver decrypts message

End-Point Authentication: sender, receiver want to confirm identity of each other Message Integrity: sender, receiver want to ensure message not altered (in transit, or afterwards) without detection

Page 4: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

4

Friends and enemies: Alice, Bob, TrudyFriends and enemies: Alice, Bob, Trudy

• well-known in network security world• Bob, Alice want to communicate “securely”• Trudy (intruder) may intercept, delete, add

messages

• well-known in network security world• Bob, Alice want to communicate “securely”• Trudy (intruder) may intercept, delete, add

messages

Page 5: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

5

5

Who might Bob, Alice be?Who might Bob, Alice be?• … well, real-life Bobs and Alices!• Web browser/server for electronic transactions (e.g., on-line purchases)• on-line banking client/server• DNS servers• routers exchanging routing table updates• other examples?

• … well, real-life Bobs and Alices!• Web browser/server for electronic transactions (e.g., on-line purchases)• on-line banking client/server• DNS servers• routers exchanging routing table updates• other examples?

Page 6: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

6

6

Simple encryption schemeSimple encryption schemesubstitution cipher: substituting one thing for

another– monoalphabetic cipher: substitute one letter for another

substitution cipher: substituting one thing for another– monoalphabetic cipher: substitute one letter for another

plaintext: abcdefghijklmnopqrstuvwxyz

ciphertext: mnbvcxzasdfghjklpoiuytrewq

E.g.:

Key: the mapping from the set of 26 letters to the set of 26 letters

Plaintext: i am bob

Ciphertext: s mh nkn

Page 7: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

7

7

The language of cryptographyThe language of cryptography

m plaintext messageKA(m) ciphertext, encrypted with key KAm = KB(KA(m))

m plaintext messageKA(m) ciphertext, encrypted with key KAm = KB(KA(m))

Page 8: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

8

8

Types of CryptographyTypes of Cryptography• Crypto often uses keys:

– Algorithm is known to everyone– Only “keys” are secret

• Public key cryptography – Involves the use of two keys

• Symmetric key cryptography– Involves the use one key

• Hash functions– Involves the use of no keys– Nothing secret: How can this be useful?

• Crypto often uses keys:– Algorithm is known to everyone– Only “keys” are secret

• Public key cryptography – Involves the use of two keys

• Symmetric key cryptography– Involves the use one key

• Hash functions– Involves the use of no keys– Nothing secret: How can this be useful?

Page 9: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

9

9

Cryptography Cryptography • Overview• Symmetric Key Cryptography• Public Key Cryptography• Message integrity and digital signaturesReferences:Stallings

Kurose and RossNetwork Security: Private Communication in a Public World, Kaufman, Perlman, Speciner

• Overview• Symmetric Key Cryptography• Public Key Cryptography• Message integrity and digital signaturesReferences:Stallings

Kurose and RossNetwork Security: Private Communication in a Public World, Kaufman, Perlman, Speciner

Page 10: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

10

10

Symmetric key cryptographySymmetric key cryptography

symmetric key crypto: Bob and Alice share same (symmetric) key: K• e.g., key is knowing substitution pattern in mono alphabetic substitution cipherQ: how do Bob and Alice agree on key value?

symmetric key crypto: Bob and Alice share same (symmetric) key: K• e.g., key is knowing substitution pattern in mono alphabetic substitution cipherQ: how do Bob and Alice agree on key value?

S

Page 11: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

11

11

Prototype functionPrototype function64-bit input

S1

8bits

8 bits

S2

8bits

8 bits

S3

8bits

8 bits

S4

8bits

8 bits

S7

8bits

8 bits

S6

8bits

8 bits

S5

8bits

8 bits

S8

8bits

8 bits

64-bit intermediate

64-bit output

Loop for n rounds

8-bit to8-bitmapping

From Kaufmanet al

Page 12: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

12

12

Encrypting a large messageEncrypting a large message• Why not just break message in 64-bit blocks, encrypt each block separately?

– If same block of plaintext appears twice, will give same cyphertext. • How about:

– Generate random 64-bit number r(i) for each plaintext block m(i)– Calculate c(i) = KS( m(i) ⊕ r(i) )– Transmit c(i), r(i), i=1,2,…– At receiver: m(i) = KS(c(i)) ⊕ r(i) – Problem: inefficient, need to send c(i) and r(i)

• Why not just break message in 64-bit blocks, encrypt each block separately?– If same block of plaintext appears twice, will give same cyphertext.

• How about:– Generate random 64-bit number r(i) for each plaintext block m(i)– Calculate c(i) = KS( m(i) ⊕ r(i) )– Transmit c(i), r(i), i=1,2,…– At receiver: m(i) = KS(c(i)) ⊕ r(i) – Problem: inefficient, need to send c(i) and r(i)

Page 13: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

13

13

Symmetric key crypto: DESSymmetric key crypto: DESDES: Data Encryption Standard• US encryption standard [NIST 1993]• 56-bit symmetric key, 64-bit plaintext input• Block cipher with cipher block chaining• How secure is DES?

– DES Challenge: 56-bit-key-encrypted phrase decrypted (brute force) in less than a day

– No known good analytic attack• making DES more secure:

– 3DES: encrypt 3 times with 3 different keys(actually encrypt, decrypt, encrypt)

DES: Data Encryption Standard• US encryption standard [NIST 1993]• 56-bit symmetric key, 64-bit plaintext input• Block cipher with cipher block chaining• How secure is DES?

– DES Challenge: 56-bit-key-encrypted phrase decrypted (brute force) in less than a day

– No known good analytic attack• making DES more secure:

– 3DES: encrypt 3 times with 3 different keys(actually encrypt, decrypt, encrypt)

Page 14: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

14

14

AES: Advanced Encryption StandardAES: Advanced Encryption Standard

• new (Nov. 2001) symmetric-key NIST standard, replacing DES

• processes data in 128 bit blocks• 128, 192, or 256 bit keys• brute force decryption (try each key)

taking 1 sec on DES, takes 149 trillion years for AES

• new (Nov. 2001) symmetric-key NIST standard, replacing DES

• processes data in 128 bit blocks• 128, 192, or 256 bit keys• brute force decryption (try each key)

taking 1 sec on DES, takes 149 trillion years for AES

Page 15: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

15

15

Cryptography Cryptography • Overview• Symmetric Key Cryptography• Public Key Cryptography• Message integrity and digital signaturesReferences:Stallings

Kurose and RossNetwork Security: Private Communication in a Public World, Kaufman, Perlman, Speciner

• Overview• Symmetric Key Cryptography• Public Key Cryptography• Message integrity and digital signaturesReferences:Stallings

Kurose and RossNetwork Security: Private Communication in a Public World, Kaufman, Perlman, Speciner

Page 16: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

16

16

Public Key CryptographyPublic Key Cryptographysymmetric key crypto• requires sender,

receiver know shared secret key

• Q: how to agree on key in first place (particularly if never “met”)?

symmetric key crypto• requires sender,

receiver know shared secret key

• Q: how to agree on key in first place (particularly if never “met”)?

public key cryptography

� radically different approach [Diffie-Hellman76, RSA78]

� sender, receiver do notshare secret key

� public encryption key known to all

� private decryption key known only to receiver

Page 17: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

17

17

Public key cryptographyPublic key cryptography

Page 18: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

18

18

Public key encryption algorithmsPublic key encryption algorithms

need K ( ) and K ( ) such that

need K ( ) and K ( ) such that B B

. .

given public key K , it should be impossible to compute private key K B

B

Requirements:

1

2

RSA: Rivest, Shamir, Adelson algorithm

+ -

K (K (m)) = mBB

- +

+

-

Page 19: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

19

19

RSA: another important propertyRSA: another important propertyThe following property will be very useful later:

K (K (m)) = mBB

- +K (K (m))

BB+ -

=

use public key first, followed by

private key

use private key first, followed by

public key

Result is the same!

Page 20: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

20

20

Cryptography Cryptography • Overview• Symmetric Key Cryptography• Public Key Cryptography• Message integrity and digital signaturesReferences:Stallings

Kurose and RossNetwork Security: Private Communication in a Public World, Kaufman, Perlman, Speciner

• Overview• Symmetric Key Cryptography• Public Key Cryptography• Message integrity and digital signaturesReferences:Stallings

Kurose and RossNetwork Security: Private Communication in a Public World, Kaufman, Perlman, Speciner

Page 21: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

21

21

Message IntegrityMessage Integrity

• Allows communicating parties to verify that received messages are authentic.– Content of message has not been altered– Source of message is who/what you think it

is– Message has not been artificially delayed

(playback attack)– Sequence of messages is maintained

• Let’s first talk about message digests

• Allows communicating parties to verify that received messages are authentic.– Content of message has not been altered– Source of message is who/what you think it

is– Message has not been artificially delayed

(playback attack)– Sequence of messages is maintained

• Let’s first talk about message digests

Page 22: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

22

22

Message DigestsMessage Digests• Function H( ) that takes

as input an arbitrary length message and outputs a fixed-length string: “message signature”

• Note that H( ) is a many-to-1 function

• H( ) is often called a “hash function”

• Function H( ) that takes as input an arbitrary length message and outputs a fixed-length string: “message signature”

• Note that H( ) is a many-to-1 function

• H( ) is often called a “hash function”

• Desirable properties:– Easy to calculate– Irreversibility: Can’t

determine m from H(m)– Collision resistance:

Computationally difficult to produce m and m’ such that H(m) = H(m’)

– Seemingly random output

• Desirable properties:– Easy to calculate– Irreversibility: Can’t

determine m from H(m)– Collision resistance:

Computationally difficult to produce m and m’ such that H(m) = H(m’)

– Seemingly random output

large message

mH: HashFunction

H(m)

Page 23: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

23

23

Hash Function AlgorithmsHash Function Algorithms• MD5 hash function widely used (RFC 1321)

– computes 128-bit message digest in 4-step process.

• SHA-1 is also used.– US standard [NIST, FIPS PUB 180-1]– 160-bit message digest

• MD5 hash function widely used (RFC 1321)– computes 128-bit message digest in 4-step

process. • SHA-1 is also used.

– US standard [NIST, FIPS PUB 180-1]– 160-bit message digest

Page 24: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

24

24

Digital SignaturesDigital SignaturesCryptographic technique analogous to

hand-written signatures.• sender (Bob) digitally signs document,

establishing he is document owner/creator.

• verifiable, nonforgeable: recipient (Alice) can prove to someone that Bob, and no one else (including Alice), must have signed document

Cryptographic technique analogous to hand-written signatures.

• sender (Bob) digitally signs document, establishing he is document owner/creator.

• verifiable, nonforgeable: recipient (Alice) can prove to someone that Bob, and no one else (including Alice), must have signed document

Page 25: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

25

25

Digital SignaturesDigital SignaturesSimple digital signature for message m:• Bob signs m by encrypting with his private

key KB, creating “signed” message, KB(m)Simple digital signature for message m:• Bob signs m by encrypting with his private

key KB, creating “signed” message, KB(m)--

Page 26: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

26

26

Bob sends digitally signed message:Alice verifies signature and

integrity of digitally signed message:

Alice verifies signature and integrity of digitally signed message:

equal?

Digital signature = signed message digest

Page 27: Cryptography & digital signaturefacultymembers.sbu.ac.ir/m_taherkhani/2013f-comp/Law-2013-Ch05.… · Stallings Kurose and Ross Network Security: Private Communication in a Public

27

27

Secure e-mail: Authentication and Message IntegritySecure e-mail: Authentication and Message Integrity•Alice wants to provide sender authentication message integrity.

• Alice digitally signs message.• sends both message (in the clear) and digital signature.