Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital...

28
Security: Integrity, Authentication, Non-repudiation CS 352, Lecture 20 http://www.cs.rutgers.edu/~sn624/352-S19 Srinivas Narayana (heavily adapted from slides by Prof. Badri Nath and the textbook authors) 1

Transcript of Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital...

Page 1: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Security: Integrity, Authentication, Non-repudiation

CS 352, Lecture 20http://www.cs.rutgers.edu/~sn624/352-S19

Srinivas Narayana(heavily adapted from slides by Prof. Badri Nath and the textbook authors)

1

Page 2: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Today• Last two lectures: cryptography for confidentiality• Today: Message digests (integrity)• Digital signatures (non-repudiation, integrity)• Certificate authorities (authentication)• Using these techniques to secure a specific application (email)

Page 3: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Message DigestsIntegrity: Did my message get across without tampering?

Page 4: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Message digestsCan we ensure that a receiver can detect message tampering?

Idea: fixed-length, easy- to-compute digital �fingerprint� of a message• apply hash function H to m, get

fixed size message digest, H(m).

Cryptographic hash function properties:• Easy to calculate• Produces fixed-size msg digest

(fingerprint)• Hard to reverse: given msg digest x,

• computationally infeasible to find m such that x = H(m)

• Or another m’ such that H(m) = H(m’)

large message

m

H: HashFunction

H(m)

4

Page 5: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Internet checksum: a poor crypto hash functionInternet checksum has some properties of hash function:• produces fixed length digest (16-bit sum) of message• Is easy to compute

But given message with given hash value, it is easy to find another message with same hash value:

I O U 10 0 . 9

9 B O B

49 4F 55 3130 30 2E 3939 42 D2 42

message ASCII format

B2 C1 D2 AC

I O U 90 0 . 1

9 B O B

49 4F 55 3930 30 2E 3139 42 D2 42

message ASCII format

B2 C1 D2 ACdifferent messagesbut identical checksums!

5

Page 6: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Hash function algorithms• MD5 hash function widely used (RFC 1321) • computes 128-bit message digest in 4-step process. • arbitrary 128-bit string x, appears difficult to construct

msg m whose MD5 hash is equal to x• SHA-1 is also used• US standard [NIST, FIPS PUB 180-1]• 160-bit message digest

6

Page 7: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Basic idea of crypto hash function

•Use a message as key and transform a constant string of length N repeatedly into another string of length N which is the digest• Simple example: XOR the constant string with the

message bytes• In practice, use a set of Boolean operations

Page 8: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Message Authentication Code (MAC)

mes

sage

H( )

s

mes

sage

mes

sage

s

H( )

compare

s = shared secret

• Authenticates sender• Verifies message integrity• No encryption!• Also called “keyed hash”• Notation: MDm = H(s || m) ; send m || MDm

Internet

Page 9: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

HMAC• popular MAC standard• addresses some subtle security flaws• operation:• concatenates secret to front of message. • hashes concatenated message• concatenates secret to front of digest• hashes combination again

Page 10: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Digital SignaturesNon-repudiation and integrity

Page 11: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Digital signatures

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

11

Page 12: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

simple digital signature for message m:• Bob signs m by encrypting with his private key KB,

creating �signed� message, KB(m)--

Dear AliceOh, how I have missed you. I think of you all the time! …(blah blah blah)

Bob

Bob�s message, m

Public keyencryptionalgorithm

Bob�s privatekey

K B-

Bob’s message, m, signed

(encrypted) with his private key

m,K B- (m)

Digital signatures

12

Page 13: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

-

Alice thus verifies that:§ Bob signed m§ no one else signed m§ Bob signed m and not m�

non-repudiation:ü Alice can take m, and signature KB(m) to court and

prove that Bob signed m-

Digital signatures § suppose Alice receives msg m, with signature: m, KB(m)§ Alice verifies m signed by Bob by applying Bob�s public

key KB to KB(m) then checks KB(KB(m) ) = m.§ If KB(KB(m) ) = m, whoever signed m must have used

Bob�s private key.

-

--

+

+ +

13

One problem: we need to encrypt (large) messages using public key crypto!

Page 14: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

large message

mH: Hashfunction H(m)

digitalsignature(encrypt)

Bob�s private

key K B-

+

Bob sends digitally signed message:

Alice verifies signature, integrity of digitally signed message:

KB(H(m))-encrypted msg digest

KB(H(m))-encrypted msg digest

large message

m

H: Hashfunction

H(m)

digitalsignature(decrypt)

H(m)

Bob�s public

key K B+

equal?

Digital signature = encrypted message digest

14

Page 15: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Authentication & Key CertificationHello… is it me you’re looking for?

Page 16: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Recall: Implement authentication using crypto

Bob

Login: Alice

“Password please” + Nonce

EK(Alice’s password, Nonce)

• Use a nonce to prevent replay attacks

• Communicate using a shared secret K

Alice

Page 17: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

AuthenticationPrevious proposal requires shared symmetric key • Can we authenticate using public key techniques?Sure! use nonce and public key cryptography

�I am Alice�R

Bob computes

K (R)A-

�send me your public key�

K A+

(K (R)) = RA-

K A+

and knows only Alice could have the private key, that encrypted R

such that(K (R)) = RA

-K A

+

17

Page 18: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Security hole: if you ask for public keys!man (or woman) in the middle attack: Trudy poses as

Alice (to Bob) and as Bob (to Alice)

I am Alice I am AliceR

TK (R)-

Send me your public key

TK +

AK (R)-

Send me your public key

AK +

TK (m)+

Tm = K (K (m))+

T-

Trudy gets

sends m to Alice encrypted with

Alice�s public key

AK (m)+

Am = K (K (m))+

A-

R

18

Page 19: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

difficult to detect:§ Bob receives everything that Alice sends, and vice

versa. (e.g., so Bob, Alice can meet one week later and recall conversation!)

§ problem is that Trudy receives all (plaintext) messages as well!

man (or woman) in the middle attack: Trudy poses as Alice (to Bob) and as Bob (to Alice)

19

Security hole: if you ask for public keys!

Page 20: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Key certification: Motivation• Is there a way to ensure we can reliably know the public key of

a communicating entity?

• Trust someone else (namely: a centralized authority) to check this for us

• On the Internet, trust is transitive: • We trust X (Ex: Alice trusts a certification authority)• X trusts Y (Ex: CA attests to Bob’s public key)• Hence, we can trust Y (Ex: Alice can trust Bob’s public key)

Page 21: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Certification authorities• certification authority (CA): binds public key to

particular entity, E.• E (person, router) registers its public key with CA.

• E provides �proof of identity� to CA. • CA creates certificate binding E to its public key.• certificate containing E�s public key digitally signed by CA –

CA says �this is E�s public key�

Bob�s public

key K B+

Bob�s identifying

information

digitalsignature(encrypt)

CA private

key K CA-

K B+

certificate for Bob�s public key,

signed by CA

21

Page 22: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

• when Alice wants Bob�s public key:• gets Bob�s certificate (from Bob or elsewhere).• apply CA�s public key to Bob�s certificate, get

Bob�s public key

Bob�s public

key K B+

digitalsignature(decrypt)

CA public

key K CA

+

K B+

Certification authorities

22

Page 23: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

PGP: E-mail SecurityAn application of security principles to application-layer security

Page 24: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Secure e-mail

Alice:§ generates random symmetric private key, KS§ encrypts message with KS (for efficiency)§ also encrypts KS with Bob�s public key§ sends both KS(m) and KB(KS) to Bob

Alice wants to send confidential e-mail, m, to Bob.

KS( ).

KB( ).+

+ -

KS(m )

KB(KS )+

m

KS

KS

KB+

Internet

KS( ).

KB( ).-

KB-

KS

mKS(m )

KB(KS )+

24

Page 25: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Secure e-mail

Bob:§ uses his private key to decrypt and recover

KS§ uses KS to decrypt KS(m) to recover m

Alice wants to send confidential e-mail, m, to Bob.

KS( ).

KB( ).+

+ -

KS(m )

KB(KS )+

m

KS

KS

KB+

Internet

KS( ).

KB( ).-

KB-

KS

mKS(m )

KB(KS )+

25

Page 26: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Secure e-mail (continued)Alice wants to provide sender authentication and message integrity

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

H( ). KA( ).-

+ -

H(m )KA(H(m))-m

KA-

Internet

m

KA( ).+

KA+

KA(H(m))-

mH( ). H(m )

compare

26

Page 27: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

Secure e-mail (continued)Alice wants to provide confidentiality, sender authentication, and message integrity.

Alice uses three keys: her private key, Bob�s public key, newly created symmetric key

H( ). KA( ).-

+

KA(H(m))-m

KA-

m

KS( ).

KB( ).++

KB(KS )+

KS

KB+

Internet

KS

27

Page 28: Security: Integrity, Authentication, Non-repudiationsn624/352-S19/lectures/20...compute digital fingerprint of a message •apply hash function H to m, get fixed size message digest,

PGP: Pretty Good Privacy• Security implemented at the application level• Allows all of the communication modes described earlier

• Uses a “web of trust” for key exchange

• Key signing: any party X can “sign” that they trust the public key of Y using their private keys

• Propagate trust: If Z trusts X, Z can now trust Y