CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 5: Logs and Trees

Slides:



Advertisements
Similar presentations
Chapter 3 Public Key Cryptography and Message authentication.
Advertisements

David Evans CS588: Cryptography University of Virginia Computer Science Lecture 17: Public-Key Protocols.
Digital Signatures and Hash Functions. Digital Signatures.
Cryptography in World War II Jefferson Institute for Lifelong Learning at UVa Spring 2006 David Evans Class 4: Modern Cryptography
OOP/Java1 Public Key Crytography From: Introduction to Algorithms Cormen, Leiserson and Rivest.
Public-key Cryptography Montclair State University CMPT 109 J.W. Benham Spring, 1998.
ECOMMERCE TECHNOLOGY SUMMER 2002 COPYRIGHT © 2002 MICHAEL I. SHAMOS Cryptographic Security.
Public Key Crytography1 From: Introduction to Algorithms Cormen, Leiserson and Rivest.
ECOMMERCE TECHNOLOGY FALL 2003 COPYRIGHT © 2003 MICHAEL I. SHAMOS Cryptography.
Cryptography Lecture 11: Oct 12. Cryptography AliceBob Cryptography is the study of methods for sending and receiving secret messages. adversary Goal:
WS Algorithmentheorie 03 – Randomized Algorithms (Public Key Cryptosystems) Prof. Dr. Th. Ottmann.
Cryptography and Network Security Chapter 9. Chapter 9 – Public Key Cryptography and RSA Every Egyptian received two names, which were known respectively.
Public Key Cryptography and the RSA Algorithm
1 CPSC156: The Internet Co-Evolution of Technology and Society Lectures 19,20, and 21: April 5, 10, and 12, 2007 Cryptographic Primitives.
Cryptography1 CPSC 3730 Cryptography Chapter 9 Public Key Cryptography and RSA.
Introduction to Modern Cryptography Lecture 7 1.RSA Public Key CryptoSystem 2.One way Trapdoor Functions.
Theory I Algorithm Design and Analysis (9 – Randomized algorithms) Prof. Dr. Th. Ottmann.
Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender and receiver if this key is disclosed communications.
WS Algorithmentheorie 03 – Randomized Algorithms (Public Key Cryptosystems) Prof. Dr. Th. Ottmann.
Fall 2010/Lecture 311 CS 426 (Fall 2010) Public Key Encryption and Digital Signatures.
Dr.Saleem Al_Zoubi1 Cryptography and Network Security Third Edition by William Stallings Public Key Cryptography and RSA.
1 Pertemuan 08 Public Key Cryptography Matakuliah: H0242 / Keamanan Jaringan Tahun: 2006 Versi: 1.
ELECTRONIC PAYMENT SYSTEMSFALL 2001COPYRIGHT © 2001 MICHAEL I. SHAMOS Electronic Payment Systems Lecture 6 Epayment Security II.
Public Key Cryptography RSA Diffie Hellman Key Management Based on slides by Dr. Lawrie Brown of the Australian Defence Force Academy, University College,
Introduction to Public Key Cryptography
Public Key Model 8. Cryptography part 2.
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
Chapter 12 Cryptography (slides edited by Erin Chambers)
Rachana Y. Patil 1 1.
Lecture 11: Key Distribution
Chi-Cheng Lin, Winona State University CS 313 Introduction to Computer Networking & Telecommunication Network Security (A Very Brief Introduction)
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 4: Introducing Recursive Definitions.
Great Theoretical Ideas in Computer Science.
Cryptography Dec 29. This Lecture In this last lecture for number theory, we will see probably the most important application of number theory in computer.
Public Key Encryption and the RSA Public Key Algorithm CSCI 5857: Encoding and Encryption.
1 Lecture 9 Public Key Cryptography Public Key Algorithms CIS CIS 5357 Network Security.
Public-Key Cryptography CS110 Fall Conventional Encryption.
David Evans CS200: Computer Science University of Virginia Computer Science Class 36: Public-Key Cryptography If you want.
CS526: Information Security Prof. Sam Wagstaff September 16, 2003 Cryptography Basics.
4 th lecture.  Message to be encrypted: HELLO  Key: XMCKL H E L L O message 7 (H) 4 (E) 11 (L) 11 (L) 14 (O) message + 23 (X) 12 (M) 2 (C) 10 (K) 11.
Chapter 21 Public-Key Cryptography and Message Authentication.
A Method for Obtaining Digital Signatures and Public-key Cryptosystems
David Evans CS200: Computer Science University of Virginia Computer Science Lecture 4: Recursive Definitions.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 4: Dynamic Programming, Trees
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
Public Key Cryptography. symmetric key crypto requires sender, receiver know shared secret key Q: how to agree on key in first place (particularly if.
1 Public-Key Cryptography and Message Authentication.
Computer and Network Security Rabie A. Ramadan Lecture 6.
Cryptography and Network Security Chapter 9 - Public-Key Cryptography
CS461/ECE422 Spring 2012 Nikita Borisov — UIUC1.  Text Chapters 2 and 21  Handbook of Applied Cryptography, Chapter 8 
Merkle-Hellman Knapsack Cryptosystem
PUBLIC-KEY CRYPTOGRAPH IT 352 : Lecture 2- part3 Najwa AlGhamdi, MSc – 2012 /1433.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 23: Review.
Lecture 2: Introduction to Cryptography
Cryptography and Network Security Public Key Cryptography and RSA.
Chapter 3 – Public Key Cryptography and RSA (A). Private-Key Cryptography traditional private/secret/single-key cryptography uses one key shared by both.
Chapter 9 Public Key Cryptography and RSA. Private-Key Cryptography traditional private/secret/single key cryptography uses one key shared by both sender.
The First Ten Years of Public-Key Cryptography Paper by: Whitfield Diffie Presentation by Taotao Zhao.
Fall 2002CS 395: Computer Security1 Chapter 9: Public Key Cryptography.
Public Key Algorithms Lesson Introduction ●Modular arithmetic ●RSA ●Diffie-Hellman.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 4: The Value of Everything.
PUBLIC-KEY CRYPTOGRAPHY AND RSA – Chapter 9 PUBLIC-KEY CRYPTOGRAPHY AND RSA – Chapter 9 Principles Applications Requirements RSA Algorithm Description.
David Evans CS150: Computer Science University of Virginia Computer Science Lecture 5: Recursing on Lists.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 6: Ordered Data Abstractions
Introduction to Pubic Key Encryption CSCI 5857: Encoding and Encryption.
Public Key Cryptosystem In Symmetric or Private Key cryptosystems the encryption and decryption keys are either the same or can be easily found from each.
CSCE 715: Network Systems Security Chin-Tser Huang University of South Carolina.
CSEN 1001 Computer and Network Security Amr El Mougy Mouaz ElAbsawi.
Chapter 3 - Public-Key Cryptography & Authentication
Presentation transcript:

CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 5: Logs and Trees

2 UVa CS216 Spring Lecture 5: Logs and Trees Menu Ron Rivest’s talk –Mixnets and voting –Public-key cryptography (dynamic programming) Trees PS1

3 UVa CS216 Spring Lecture 5: Logs and Trees MIXes C1 C2 C3 C4 M1 M2 M3 M4 Random, secret permutation Encrypted Votes Decrypted Votes

4 UVa CS216 Spring Lecture 5: Logs and Trees Security Properties C1 C2 C3 C4 M1 M2 M3 M4 1. Voters must be able to create votes, but not decrypt them. 2. Observer should be able to verify that output votes correspond to input votes, but not match up votes.

5 UVa CS216 Spring Lecture 5: Logs and Trees Public-Key Cryptography Private procedure: E Public procedure: D Identity: E (D (m)) = D (E (m)) = m Secure: cannot determine E from D Concept stated by Whitfield Diffie and Martin Hellman in 1976, but didn’t know how to find suitable E and D

6 UVa CS216 Spring Lecture 5: Logs and Trees RSA The era of “electronic mail” [Potter1977] may soon be upon us; we must ensure that two important properties of the current “paper mail” system are preserved: (a) messages are private, and (b) messages can be signed. R. Rivest, A. Shamir and L. Adleman. A Method for Obtaining Digital Signatures and Public-Key Cryptosystems. Jan 1978.

7 UVa CS216 Spring Lecture 5: Logs and Trees Public encryption function Private encryption function We will not attempt to explain why it works and is (probably) secure in CS216. See links to paper and slides.

8 UVa CS216 Spring Lecture 5: Logs and Trees Implementing RSA def RSAencrypt (M, e, n): if e == 0: return 1 else: return (M * RSAencrypt (M, e - 1, n)) % n Note: this actually “works” in Python even though RSA needs 100+-digit values (but not in Java) because integers are not limited to a fixed size. We’ll consider number representations later in the class. 200-digit number

9 UVa CS216 Spring Lecture 5: Logs and Trees Result … File "C:\cs216\workspace\ps2\RSA.py", line 17, in RSAencrypt return (M * RSAencrypt (M, e - 1, n)) % n File "C:\cs216\workspace\ps2\RSA.py", line 17, in RSAencrypt return (M * RSAencrypt (M, e - 1, n)) % n File "C:\cs216\workspace\ps2\RSA.py", line 17, in RSAencrypt return (M * RSAencrypt (M, e - 1, n)) % n RuntimeError: maximum recursion depth exceeded

10 UVa CS216 Spring Lecture 5: Logs and Trees Analyzing RSA def RSAencrypt (M, e, n): if e == 0: return 1 else: return (M * RSAencrypt (M, e - 1, n)) % n How many recursive calls? The value of the e parameter (scales as O(2 e ) size of e ) Can we use dynamic programming (and math) to make this faster?

11 UVa CS216 Spring Lecture 5: Logs and Trees Fast Exponentiation a 9 = a  a  a  a  a  a  a  a a9a9 a4a4 a4a4 a a2a2 a2a2 aaaa a2a2 a2a2 aaaa Multiplication is associative

12 UVa CS216 Spring Lecture 5: Logs and Trees Fast Exponentiation def square (x): return x * x def RSAencrypt (M, e, n): if e == 0: return 1 elif e % 2 == 0: return square(RSAencrypt (M, e/2, n)) % n else: return (M * RSAencrypt (M, e - 1, n)) % n

13 UVa CS216 Spring Lecture 5: Logs and Trees Analysis How many recursive calls? def square (x): return x * x def RSAencrypt (M, e, n): if e == 0: return 1 elif e % 2 == 0: return square(RSAencrypt (M, e/2, n)) % n else: return (M * RSAencrypt (M, e - 1, n)) % n a9a9 a8a8 a a4a4 a2a2 a Worst case: e = 2 q – 1 2q calls   (log 2 e)

14 UVa CS216 Spring Lecture 5: Logs and Trees Logarithms Review Logarithm is inverse of exponential Bases –Is log 2 f(x)  O (log 3 f(x)) ? –Is log 2 f(x)  Ω (log 3 f(x)) ? x = log b b x = b log b x

15 UVa CS216 Spring Lecture 5: Logs and Trees Changing Bases x = b log b x log a x = log a (b log b x ) log a x = log a b  log a (log b x) 1 = log a b / log a x  log b x log b x = log a x / log a b So, within O, Θ, Ω the base doesn’t matter

16 UVa CS216 Spring Lecture 5: Logs and Trees Logs and Trees Many tree algorithms have running time  log(N) where N is the number of nodes in the tree, since for a well balanced tree N = b h h ~ log b (N)

17 UVa CS216 Spring Lecture 5: Logs and Trees Implementing RSA Recursive calls   (log 2 e) Running time   (log 2 e) if multiplication time is O(1) def square (x): return x * x def RSAencrypt (M, e, n): if e == 0: return 1 elif e % 2 == 0: return square(RSAencrypt (M, e/2, n)) % n else: return (M * RSAencrypt (M, e - 1, n)) % n a9a9 a8a8 a a4a4 a2a2 a Note that this cannot really be true!

18 UVa CS216 Spring Lecture 5: Logs and Trees Public-Key Applications: Privacy Alice encrypts message to Bob using Bob’s Private Key Only Bob knows Bob’s Private Key  only Bob can decrypt message Encrypt Decrypt Plaintext Ciphertext Plaintext Alice Bob Bob’s Public Key Bob’s Private Key

19 UVa CS216 Spring Lecture 5: Logs and Trees Signatures Bob knows it was from Alice, since only Alice knows Alice’s Private Key Non-repudiation: Alice can’t deny signing message (except by claiming her key was stolen!) Integrity: Bob can’t change message (doesn’t know Alice’s Private Key) Encrypt Decrypt Plaintext Signed Message Plaintext Alice Bob Alice’s Private Key Alice’s Public Key

20 UVa CS216 Spring Lecture 5: Logs and Trees MIXes C1 C2 C3 C4 M1 M2 M3 M4 Random, secret permutation Encrypted Votes Decrypted Votes Mux keys: KU M, KR M C1 = E KU M [“Kerry”] M = E KR M [C] Opps…doesn’t work: anyone can use public key to compute E KU M [M] for outputs and compare to inputs.

21 UVa CS216 Spring Lecture 5: Logs and Trees MIXes C1 C2 C3 C4 M1 M2 M3 M4 Random, secret permutation Encrypted Votes Mux keys: KU M, KR M C1 = E KU M [“Kerry” + R1] M = left part of E KR M [C] Random, secret value picked by voter

22 UVa CS216 Spring Lecture 5: Logs and Trees Voting Application C1 C2 C3 C4 M1 M2 M3 M4 Republicrat Party Democrican Party Orange Party C = E KUR [E KUD [E KUG [“Badnarik” || R 1 ] R 2 ] R 3 ] Each mux decrypts with private key and removes R

23 UVa CS216 Spring Lecture 5: Logs and Trees Voting Application C1 C2 C3 C4 M1 M2 M3 M4 Republicrat Party Democrican Party Orange Party “Nader” How to verify muxes?

24 UVa CS216 Spring Lecture 5: Logs and Trees Voting Caveat Real problems with voting have very little to do with cryptography or mixes…

25 UVa CS216 Spring Lecture 5: Logs and Trees Trees

26 UVa CS216 Spring Lecture 5: Logs and Trees Tree Node Operations getLeftChild (Node) getRightChild (Node) getInfo (Node) def isLeaf (self): return self.getLeftChild () == None and self.getRightChild () == None

27 UVa CS216 Spring Lecture 5: Logs and Trees Calculating Height def height (self): if self.isLeaf (): return 0 else: return 1 + max(self.getLeftChild().height(), self.getRightChild().height()) Height of a Node: length of the longest path from that node to a leaf

28 UVa CS216 Spring Lecture 5: Logs and Trees Analyzing Height What is the asymptotic running time or our height procedure? def height (self): if self.isLeaf (): return 0 else: return 1 + max(self.getLeftChild().height(), self.getRightChild().height())

29 UVa CS216 Spring Lecture 5: Logs and Trees Tree Preorder Traversal B A C J E KH D I F L G M

30 UVa CS216 Spring Lecture 5: Logs and Trees Preorder Traversal def preorder (t): print t.info() for c in t.children(): c.preorder () N is number of nodes in t Running time: Θ(N) Space use: worst case: O(N) well-balanced case: O(log N)

31 UVa CS216 Spring Lecture 5: Logs and Trees PS1 Returned in section today

32 UVa CS216 Spring Lecture 5: Logs and Trees Deductive Analysis Goals of CS216: –Connect high level code to bits in machine –Connect theory to practice This is unusual and hard! –Questions 4-6: use concrete experiments to guess theoretical properties and then concrete properties of an implementation –Question 9: predict how long Lots of answers like ~2 1000

33 UVa CS216 Spring Lecture 5: Logs and Trees CS216 PS Grading Scale  Gold Star – Excellent Work. You got everything I wanted on this PS.  Green Star – Better than good work  Blue Star – Good Work. You got most things on this PS, but some answers could be better.  Silver Star – Some problems. Make sure you understand the comments.  Red Star – Serious problems and lack of effort. PS1 Average: 

34 UVa CS216 Spring Lecture 5: Logs and Trees No upper limit  - Double Gold Star: exceptional work! Better than I expected anyone would do.  - Triple Gold Star: Better than I thought possible  - Quadruple Gold Star: You have broken important new ground in CS which should be published in a major journal! (e.g., invented a alignment algorithm better than BLAST)  - Quintuple Gold Star: You deserve a Turing Award! (find an O(n k ) solution to finding optimal phylogenies)

35 UVa CS216 Spring Lecture 5: Logs and Trees Question 11 Complaints about not being “straightforward” what you are expected to do

36 UVa CS216 Spring Lecture 5: Logs and Trees Philosophy “This generation of students got into Harvard by doing exactly and precisely what teacher wants. If teacher is vague about what he [sic] wants, they work a lot harder to figure out what they want and whether or not it is good. The vaguer the directions, the more likely the opportunity for serendipity to happen. It drives them nuts!” Harvard Professor John StilgoeJohn Stilgoe (on 60 Minutes, 4 January 2004)

37 UVa CS216 Spring Lecture 5: Logs and Trees Charge Today and tomorrow: –Sections in Thorton D classrooms Wednesday: PS2 is Due!