lecture 2 - department of computer scienceabhishek/classes/cs601-641-441-spring...hash pointer...

18
Lecture 2 Crypto Background – II

Upload: others

Post on 04-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Lecture 2Crypto Background – II

Page 2: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Hash Pointers and Data Structures

Page 3: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Hash pointer● pointer to where some info is stored, and● cryptographic hash of the info

If we have a hash pointer, we can● ask to get the info back, and● verify that it hasn’t changed

Page 4: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

(data)

H( )

will draw hash pointers like this

Page 5: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Building data structures with hash pointers

Page 6: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Linked list with hash pointers

data

prev: H( )

data

prev: H( )

data

prev: H( )

H( )

use case: tamper-evident log

= “Blockchain”

Page 7: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

detecting tampering

data

prev: H( )

data

prev: H( )

data

prev: H( )

H( )

use case: tamper-evident log

Page 8: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

binary tree with hash pointers = “Merkle tree”

H( ) H( )

H( ) H( ) H( ) H( )

H( ) H( ) H( ) H( ) H( ) H( ) H( ) H( )

(data) (data) (data) (data) (data) (data) (data) (data)

Page 9: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

proving membership in a Merkle tree

H( ) H( )

H( ) H( )

H( ) H( )

(data)

show O(log n) items

Page 10: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Advantages of Merkle trees

● Tree holds many items, but just need to remember the root hash

● Can verify membership in O(log n) time/space

Variant: sorted Merkle tree● can verify non-membership in O(log n)● show items before, after the missing one

Page 11: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

More generally ...

Can use hash pointers in any pointer-baseddata structure that has no cycles

Page 12: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Digital Signatures

Page 13: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

What we want from signatures

● Only you can sign, but anyone can verify● Signature is tied to a particular document

(can’t be cut-and-pasted to another doc)

● Even if one can see your signature on some documents, he cannot “forge” it

Page 14: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Digital signatures

● (sk, pk) ß keygen(1k)sk: secret signing key

pk: public verification key

● sig ß sign(sk, message)

● isValid ß verify(pk, message, sig)

randomizedalgorithm

Security parameter

Typically randomized

Page 15: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Requirements for signatures

● Correctness: “valid signatures verify”○ verify(pk, message, sign(sk, message)) == true

● Unforgeability under chosen-message attacks (UF-CMA): “can’t forge signatures”○ adversary who knows pk, and gets to see signatures on messages of his

choice, can’t produce a verifiable signature on another message

Page 16: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Challenger Adversary

(sk, pk) ß keygen(1k)

m0

sign(sk, m0)

m1

sign(sk, m1)

. . .M, sig

M not in { m0, m1, … }

verify(pk, M, sig)

ifValid, attacker wins

pk

UF-CMA Security

Definition: A signature scheme (keygen,sign,verify) is UF-CMA secure if for every PPT adversary A, there exists a negligible function n(k) s.t.Pr[A wins in above game] = n(k)

Page 17: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

Notes

● Signatures can be shorter than message: signHash(message) rather than message

● Algorithms are randomized: need good source of randomness. Bad randomness may reveal the secret key

● fun trick: sign a hash pointer. signature “covers” the whole structure

Page 18: Lecture 2 - Department of Computer Scienceabhishek/classes/CS601-641-441-Spring...Hash pointer pointer to where some info is stored, and cryptographichash of the info If we have a

● Bitcoin uses Elliptic Curve Digital Signature Algorithm (ECDSA)

● ECDSA is a close variant of Schnorr Signature scheme over Elliptic curves

Notes…