48
Cryptocurrency Cabal cs4501 Fall 2015 David Evans and Samee Zahur University of Virginia Class 2: Cryptograp hy

Introduction to Cryptography

Embed Size (px)

Citation preview

Page 1: Introduction to Cryptography

Cryptocurrency Cabalcs4501 Fall 2015David Evans and Samee ZahurUniversity of Virginia

Class 2:Cryptography

Page 2: Introduction to Cryptography

2

Upcoming Schedule• Today: Introduction to Cryptography• Wednesday: ECC and Signatures– Elliptic Curve Cryptography, ECDSA

• Next Monday: Checkup 1– Covers classes 1-3, readings (see notes)

• Tuesday, 15 September: Problem Set 1

Page 3: Introduction to Cryptography

3

Readings

Chapters 1-4 (skim Ch 3)

Page 4: Introduction to Cryptography

4

Who’s in the class?

BS Computer Science (16)BA Computer Science (10)BS Computer Engineering (4)Mathematics (6)Economics (3)Aerospace EngineeringBusiness (McIntire)HistoryLinguisticsPolitical and Social ThoughtPolitics

Page 5: Introduction to Cryptography

5

Plan for Today• Bitcoin Wallet• Notion of ownership of non-physical good• Conceptual understanding of key terms and

principles in cryptographyCryptosystem, Attacks, Asymmetric Crypto

Several ways Bitcoin Wallet uses cryptography

Page 6: Introduction to Cryptography

6

Setting up a Bitcoin Wallet

Page 7: Introduction to Cryptography

7

Page 8: Introduction to Cryptography

8

Downloading entire blockchain (~40GB)…takes several days…

Page 9: Introduction to Cryptography

9

Page 10: Introduction to Cryptography
Page 11: Introduction to Cryptography

HD:HierarchicalDeterministicWallet

Page 12: Introduction to Cryptography
Page 13: Introduction to Cryptography
Page 14: Introduction to Cryptography

14

Page 15: Introduction to Cryptography

15

Recap: Class 1Currency is a medium of exchangeAt a minimum, must be:

transferable – can be exchangedscarce – limited supply

Can we make something scarce and transferable with just bits?

Page 16: Introduction to Cryptography

16

How can someone own something made of bits?

Page 17: Introduction to Cryptography

17

How can someone own anything easily reproduced?

Page 18: Introduction to Cryptography

18

Mechanized printingGutenberg movable type press: ~1450

Page 19: Introduction to Cryptography

19

Worshipful Company of Stationers and Newspaper Makers(“Stationer’s Company”)

London 1403Royal Charter 1557Monopoly on printingResponsibility to censor

Page 20: Introduction to Cryptography

20

“An Act for the Encouragement of Learning, by Vesting the Copies of Printed Books in the Authors or Purchasers of Copies, during the Times therein mentioned…”

Statute of Anne, 1710

Author has exclusive 14-year right to copy work (living author can extend for another 14 years)

Page 21: Introduction to Cryptography

21

US Copyright Law1790: 14 years (+ 14)1831: 28 years (+ 14)1976: life of author + 50 (75 for “corporate”)1998: life of author + 70 (120 for “corporate”)

Created 1928

Page 22: Introduction to Cryptography

22

How can someone own

something made of bits without

an army (or moose) helping?

Page 23: Introduction to Cryptography

23

Cryptography

Page 24: Introduction to Cryptography

24

Previous Cryptography Experience

None; 20

Little; 8

Prof. Mahmoody’s Course, 2

Do you have any previous experience with cryptography?

Page 25: Introduction to Cryptography

25

What is cryptology?Greek: ´oκρυπτ ς = “kryptos” = hidden (secret)Cryptography – secret writingCryptanalysis – analyzing (breaking) secrets

Cryptanalysis is what an attacker doesDecryption is what the intended receiver does

Cryptosystems – systems that use secretsCryptology – science of secrets

Page 26: Introduction to Cryptography

26

Security is an engineering goal: it involves mathematics, but is mostly about real implementations and people.

Cryptology is a branch of mathematics: about abstract numbers and functions.

Page 27: Introduction to Cryptography

27

Introductions

Encrypt DecryptPlaintextCiphertext

Plaintext

Alice Bob

Eve(passive attacker)

Insecure Channel

Page 28: Introduction to Cryptography

28

Active Attacker

Encrypt DecryptPlaintextCiphertext

Plaintext

Alice Bob

Insecure Channel (e.g., the Internet)

Mallory(active attacker)

Page 29: Introduction to Cryptography

29

Message CryptosystemEncrypt

DecryptPlaintext Ciphertext

PlaintextCiphertext

Two functions: E(m: byte[]) byte[] and D(c: byte[]) byte[]

Correctness property: for all possible messages m, D(E(m)) = m

Security property: given c E(m), it is “hard” to learn anything interesting about m.

Page 30: Introduction to Cryptography

30

It is possible to state the security property precisely (and prove a cryptosystem satisfies it given hardness assumptions).Shafi Goldwasser and Silvio Micali

2013 Turing Award Winners(for doing this in the 1980s)

Page 31: Introduction to Cryptography

31

Message CryptosystemEncrypt

DecryptPlaintext Ciphertext

PlaintextCiphertext

Two functions: E(m: byte[]) byte[] and D(c: byte[]) byte[]

Correctness property: for all possible messages m, D(E(m)) = m

Security property: given c E(m), it is “hard” to learn anything interesting about m.

Page 32: Introduction to Cryptography

32

Auguste Kerckhoffs

Kerckhoff’s Principle

Page 33: Introduction to Cryptography

33

“The enemy knows the system being used.”

Claude Shannon, Communication Theory

of Secrecy Systems (1949)

Claude Shannon1916-2001

Page 34: Introduction to Cryptography

34

(Keyed) Symmetric CryptosystemEncrypt DecryptPlaintext

CiphertextPlaintext

Insecure Channel

Encrypt DecryptPlaintextCiphertext

PlaintextInsecure Channel

Key Key

Only secret is the key, not the E and D functions that now take key as input

Asymmetric crypto:different keys for E and D, so you can reveal E without revealing D.

Page 35: Introduction to Cryptography

35

Jefferson’s Wheel Cipher

Page 36: Introduction to Cryptography

36

Jefferson’s Wheel Cipher26 wheels arranged in a secret order on a

spindle, each wheel has randomly-permutated alphabet around rim

Encrypt: turn wheels to display plaintext, then pick a “random” row as ciphertext

Decrypt: arrange wheels in same (secret) order, line up ciphertext, look for plaintext

Page 37: Introduction to Cryptography

37

Auguste Kerckhoffs (1883)Thomas Jefferson (1790s)

Should it be “TJ’s

Principle”?

Page 38: Introduction to Cryptography

38

on the periphery of each, and between the black lines, put all the letters of the alphabet, not in their established order, but jumbled, & without order, so that no two shall be alike. now string them in their numerical order on an iron axis, one end of which has a head, and the other a nut and screw; the use of which is to hold them firm in any given position when you choose it.

Jefferson’s description of wheel cipher (1802)

Page 39: Introduction to Cryptography

39

Key SpaceKey space: K = set of possible keys

Key is order of wheels on spindle:|K | = 26 × 25 × … × 1 > 1026 Key is jumbling of letters on wheels:|K | = (26 × 25 × … × 1)26 > 10691

Page 40: Introduction to Cryptography

40

Brute Force Attack

def brute_force(ciphertext): for guess in all_possible_keys(N): plaintext = decrypt(key, ciphertext)

if plausible_message(plaintext): return plaintext

Try all possible keys in some order, until you find one that works.

Page 41: Introduction to Cryptography

41

Brute Force Attack

def brute_force(ciphertext): for guess in all_possible_keys(N): plaintext = decrypt(key, ciphertext)

if plausible_message(plaintext): return plaintext

Try all possible keys in some order, until you find one that works.

What is necessary for brute force attack to succeed?

Page 42: Introduction to Cryptography

42

(Im)Practicality of Brute Force AttacksMinimum energy needed to flip one bit (Landauer limit) ≈ kT ln 2 ≈ 2.8 zepto-Joules

k ≈ 1.4 × 10-23 J/K (Boltzmann’s constant)T = temperature (Kelvin) (300K)

Page 43: Introduction to Cryptography

43

Bit Flips Energy WolframAlpha Description256 (DES) 2 × 10-3 J “acoustic energy in a whisper”

280 (“low security”) 3 × 103 J “metabolic energy of one gram of sugar”

26!

(Jefferson+Kerkchoffs)1 × 106 J “energy of one gram of gasoline”

2128 (AES minimum) 9 × 1017 J “twice energy consumption of

Norway in 1998”2256 (AES maximum) 3 × 1056 J

“1/120th mass energy equivalent of galaxy’s visible mass”

Page 44: Introduction to Cryptography

44

Bit Flips Energy WolframAlpha Description256 (DES) 2 × 10-3 J “acoustic energy in a whisper”

280 (“low security”) 3 × 103 J “metabolic energy of one gram of sugar”

26!

(Jefferson+Kerkchoffs)1 × 106 J “energy of one gram of gasoline”

2128 (AES minimum) 9 × 1017 J “twice energy consumption of

Norway in 1998”2256 (AES maximum) 3 × 1056 J

“1/120th mass energy equivalent of galaxy’s visible mass”

This is the best (unrealistic) possible case for a brute force attack: don’t need to do anything other than represent key and physically most efficient bit flips.

Page 45: Introduction to Cryptography

45

Bit Flips Energy WolframAlpha Description256 (DES) 2 × 10-3 J “acoustic energy in a whisper”

280 (“low security”) 3 × 103 J “metabolic energy of one gram of sugar”

26!

(Jefferson+Kerkchoffs)1 × 106 J “energy of one gram of gasoline”

2128 (AES minimum) 9 × 1017 J “twice energy consumption of

Norway in 1998”2256 (AES maximum) 3 × 1056 J

“1/120th mass energy equivalent of galaxy’s visible mass”

But, assumes better than brute force attacks are not possible. All of these ciphers have weaknesses, and are much less secure than maximum security possible for that size key.

Page 46: Introduction to Cryptography

46

Where might your wallet use

symmetric crypto?

Page 48: Introduction to Cryptography

48

Charge• Wednesday: ECC, signatures in bitcoin• See notes for readings• Checkup 1 next Monday

https://github.com/bitcoin-solutions/multibit-hd/blob/c040431dec7695244b6596b9ae0bd7e23a6f0ba5/mbhd-swing/src/main/java/org/multibit/hd/ui/views/wizards/welcome/create_wallet/CreateWalletReportPanelView.java