Berkeley CS276 & MIT 6.875 Specialized homomorphic encryption, - - PowerPoint PPT Presentation

β–Ά
berkeley cs276 mit 6 875
SMART_READER_LITE
LIVE PREVIEW

Berkeley CS276 & MIT 6.875 Specialized homomorphic encryption, - - PowerPoint PPT Presentation

Berkeley CS276 & MIT 6.875 Specialized homomorphic encryption, commitments and applications Lecturer: Raluca Ada Popa Announcements Starting to record Specialized/partial homomorphic encryption An encryption scheme that is


slide-1
SLIDE 1

Berkeley CS276 & MIT 6.875

Specialized homomorphic encryption, commitments and applications Lecturer: Raluca Ada Popa

slide-2
SLIDE 2

Announcements

  • Starting to record
slide-3
SLIDE 3

Specialized/partial homomorphic encryption

  • An encryption scheme that is homomorphic with

respect to a specific function, and cannot compute arbitrary functions like FHE

  • Usually faster than FHE due to specialization (but not

always)

3

slide-4
SLIDE 4

El Gamal encryption (1985)

A semantically secure public-key encryption scheme

4

Enc(π‘žπ‘™, 𝑛):

  • Choose random 0 ≀ 𝑠 ≀ π‘ž βˆ’ 2
  • Output (𝑕!𝑛𝑝𝑒 π‘ž, 𝑛 Γ— π‘žπ‘™! 𝑛𝑝𝑒 π‘ž)

Dec 𝑑𝑙, 𝑑!, 𝑑" :

  • Output 𝑑"𝑑#

$%& 𝑛𝑝𝑒 π‘ž

𝑑!𝑑"

#$% = 𝑛 π‘žπ‘™& 𝑕#&$% = 𝑛 𝑕$% &𝑕#& $% = 𝑛

𝑛 ∈ [1, π‘ž βˆ’ 1] Why?

How to decrypt? Setup(1)):

  • Generate large prime π‘ž of size 𝑙
  • Choose generator 1 < 𝑕 < π‘ž βˆ’ 1
  • Output (π‘ž, 𝑕)

KeyGen(1)):

  • Choose random 0 ≀ sk ≀ π‘ž βˆ’ 2
  • Let π‘žπ‘™ = 𝑕%& 𝑛𝑝𝑒 π‘ž
  • Output (𝑑𝑙, π‘žπ‘™)
slide-5
SLIDE 5

DDH assumption

5

Enc(π‘žπ‘™, 𝑛):

  • Choose random 0 ≀ 𝑠 ≀ π‘ž βˆ’ 2
  • Output (𝑕!𝑛𝑝𝑒 π‘ž, 𝑛 Γ— π‘žπ‘™! 𝑛𝑝𝑒 π‘ž)

Diffie-Hellman key exchange in disguise + used as one time pad

Semantic security relies on the Decisional Diffie Hellman assumption: For all nonuniform PPT A, | Pr 𝑕, π‘ž ← π‘‡π‘“π‘’π‘£π‘ž 1% ; 𝑏, 𝑐 ← 0, π‘ž βˆ’ 2 , 𝐡 π‘ž, 𝑕, 𝑕', 𝑕(, 𝒉𝒃𝒄 = 1 βˆ’ Pr 𝑕, π‘ž ← π‘‡π‘“π‘’π‘£π‘ž 1% ; 𝑏, 𝑐, 𝑑 ← 0, π‘ž βˆ’ 2 , 𝐡 π‘ž, 𝑕, 𝑕', 𝑕(, 𝒉𝒅 = 1 | < π‘œπ‘“π‘•π‘š(𝑙)

slide-6
SLIDE 6

Proof of security

6

Decisional Diffie Hellman assumption: βˆ€ nonuniform PPT 𝐡, | Pr 𝑕, π‘ž ← π‘‡π‘“π‘’π‘£π‘ž 1% ; 𝑏, 𝑐 ← 0, π‘ž βˆ’ 2 , 𝐡 π‘ž, 𝑕, 𝑕', 𝑕(, 𝒉𝒃𝒄 = 1 βˆ’ Pr 𝑕, π‘ž ← π‘‡π‘“π‘’π‘£π‘ž 1% ; 𝑏, 𝑐, 𝑑 ← 0, π‘ž βˆ’ 2 , 𝐡 π‘ž, 𝑕, 𝑕', 𝑕(, 𝒉𝒅 = 1 | < π‘œπ‘“π‘•π‘š(𝑙)

Claim: If DDH holds, El Gamal is semantically secure. Proof: Assume 𝐡 can break El Gamal’s security, let’s show that 𝐢 can break DDH.

𝐢 must distinguish between 𝑕', 𝑕( , 𝑕'( and 𝑕', 𝑕( , 𝑕, 𝐡 can distinguish between 𝑕$%, 𝑕&, 𝑛- 𝑕$%& and 𝑕$%, 𝑕&, 𝑛"𝑕$% & B feeds 𝑕'( or 𝑕, times 𝑛( to A for 𝑐 random. If it is 𝑕,, A cannot guess, else A guesses correctly.

slide-7
SLIDE 7

Other partially homomorphic encryption schemes

7

Scheme Homomorphism Goldwasser-Micali’82 XOR Paillier’99 + Boneh-Goh-Nissim’05 +, then one *, then + based on bilinear maps PHE/SHE (partially homomorphic encryption) Some polynomial

slide-8
SLIDE 8

Recall: commitments

8

slide-9
SLIDE 9

Pedersen commitment

Setup (1&) - at the receiver: – select large primes π‘ž and π‘Ÿ of size 𝑙 such that π‘Ÿ divides π‘ž βˆ’ 1 – select a generator 𝑕 of the order-π‘Ÿ subgroup of π‘Ž'

βˆ—

– generate randomly 𝑏 ← π‘Ž) – let β„Ž = 𝑕𝑏 𝑛𝑝𝑒 π‘ž – output (𝑕, β„Ž, π‘ž) Commit(𝑕, β„Ž, π‘ž, 𝑦) - by the sender:

  • choose random 𝑠 ← π‘Žπ‘Ÿ
  • utput 𝑑𝑝𝑛𝑛 = π‘•π‘¦β„Žπ‘  𝑛𝑝𝑒 π‘ž

Reveal - by the sender:

  • send 𝑦 and 𝑠 to receiver
  • the receiver verifies that 𝑑𝑝𝑛𝑛 = π‘•π‘¦β„Žπ‘  𝑛𝑝𝑒 π‘ž and accepts if so, else rejects

9

slide-10
SLIDE 10

Perfectly hiding

Commit(𝑕, β„Ž, π‘ž, 𝑦) - by the sender:

  • choose random 𝑠 ← π‘Žπ‘Ÿ
  • output 𝑑𝑝𝑛𝑛 = π‘•π‘¦β„Žπ‘  𝑛𝑝𝑒 π‘ž
  • For a commitment 𝑑𝑝𝑛𝑛, every 𝑦 could have been

committed to in 𝑑𝑝𝑛𝑛

  • Given 𝑦, 𝑠 and any 𝑦’, βˆƒπ‘ β€™ such that π‘•π‘¦β„Žπ‘  = π‘•π‘¦β€™β„Žπ‘ β€™

𝑠’ = 𝑦 βˆ’ 𝑦’ 𝑏!" + 𝑠 𝑛𝑝𝑒 π‘Ÿ

10

slide-11
SLIDE 11

Computationally binding

  • Assume the sender can find 𝑦’, 𝑠’, s.t 𝑦C β‰  𝑦 and

𝑑𝑝𝑛𝑛 = 𝑕D β„ŽE = 𝑕D!β„ŽE!

  • β„Ž = 𝑕𝑏 𝑛𝑝𝑒 π‘ž implies 𝑦 + 𝑏𝑠 = 𝑦’ + 𝑏𝑠’ 𝑛𝑝𝑒 π‘Ÿ
  • The sender can compute 𝑏 =

𝑦’ βˆ’ 𝑦 𝑠 βˆ’ 𝑠’ F! => Sender solved discrete logarithm of h base g!!

11

slide-12
SLIDE 12

Commit(𝑕, β„Ž, π‘ž, 𝑦) - by the sender:

  • choose random 𝑠 ← π‘Žπ‘Ÿ
  • output 𝑑𝑝𝑛𝑛(𝑦, 𝑠) = π‘•π‘¦β„Žπ‘  𝑛𝑝𝑒 π‘ž

12

Why is Pedersen homomorphic?

𝑑𝑝𝑛𝑛 𝑦", 𝑠

" βˆ— 𝑑𝑝𝑛𝑛 𝑦!, 𝑠 ! = 𝑕2!32"β„Ž&!3&" 𝑛𝑝𝑒 π‘ž

The sender reveals this commitment by showing 𝑦" + 𝑦! and 𝑠

" + 𝑠 !

slide-13
SLIDE 13

Application: zkLedger

  • Privacy-preserving auditing for distributed ledgers
  • A cryptographic system built out of:

– Pedersen commitments and their homomorphism – Zero-knowledge proofs

13

[Narula-Wasquez-Virza’18]

slide-14
SLIDE 14

First: the use case

(all cryptographic systems should have a use case)

14

slide-15
SLIDE 15

Structure of the financial system

15 JP Morgan Citibank Bank of America Credit Suisse Barclays UBS HSBC Wells Fargo BNY Mellon

  • Dozens of large

investment banks

  • Trading:

– Securities – Currencies – Commodities – Derivatives

  • Trillions of dollars

Goldman Sachs Deutsche Bank Morgan Stanley

Financial Investments Regulatory Authority on OTC markets

zkLedger slides adapted from Neha Narula

slide-16
SLIDE 16

A ledger records financial transactions

16

ID Asset From To Amount 90 $ Citibank Goldman Sachs 1,000,000 91 € JP Morgan UBS 200,000 92 € JP Morgan Barclays 3,000,000

sig sig sig

JP Morgan Citibank Barclays

Assume a trusted ledger: append-only, immutable, consistent & visible to everyone

slide-17
SLIDE 17

Can verify important financial invariants

17

ID Asset From To Amount 90 $ Citibank Goldman Sachs 1,000,000 91 € JP Morgan UBS 200,000 92 € JP Morgan Barclays 3,000,000

Consent to transfer Has assets to transfer Assets neither created nor destroyed Verify

sig sig sig

Examining ledger

slide-18
SLIDE 18

Banks care about privacy

18

Trades reveal sensitive strategy information

slide-19
SLIDE 19

Verifying invariants are maintained with privacy

19

ID Asset From To Amount 90 $ Citibank Goldman Sachs 1,000,000 91 € JP Morgan UBS 200,000 92 € JP Morgan Barclays 3,000,000

Consent to transfer Has assets to transfer Assets neither created nor destroyed Verify

sig sig sig

slide-20
SLIDE 20

Verifying invariants are maintained with privacy

20

ID Asset From, To, Amount 90 $ 91 € 92 €

Consent to transfer Has assets to transfer Assets neither created nor destroyed

Zerocash (zk-SNARKs) [S&P 2014] Solidus (PVORM) [CCS 2017]

Verify

slide-21
SLIDE 21

Problem

Regulators need insight into markets to maintain financial stability and protect investors Participants would like to measure counterparty risk

21

  • Leverage
  • Exposure
  • Overall market concentration
slide-22
SLIDE 22

How to confidently audit banks to determine risk?

22

What fraction of your assets are in Euros? 3 million / 100 million

How exposed is this bank to a drop in the Euro?

???

Auditor

slide-23
SLIDE 23

zkLedger

A private, auditable transaction ledger

  • Privacy: Hides transacting banks and amounts
  • Integrity with public verification: Everyone can

verify transactions are well-formed

  • Auditing: Compute provably-correct linear functions
  • ver transactions

23

slide-24
SLIDE 24

Outline

  • System & threat model
  • zkLedger design

– Pedersen commitments – Ledger table format – Zero-knowledge proofs

  • Evaluation

24

slide-25
SLIDE 25

Outline

  • System & threat model
  • zkLedger design

– Pedersen commitments – Ledger table format – Zero-knowledge proofs

  • Evaluation

25

slide-26
SLIDE 26

zkLedger system model

26

ID Asset Transaction details 1 $ 2 € 3 €

slide-27
SLIDE 27

An auditor can obtain correct answers on ledger contents

27

ID Asset Transaction details 1 $ 2 € 3 € Auditor

What fraction of your assets are in Euros?

Ο€

3 million / 100 million

slide-28
SLIDE 28

Measurements zkLedger supports

  • Ratios and percentages of holdings
  • Sums, averages, variance, skew
  • Outliers
  • Approximations and orders of magnitude
  • Changes over time
  • Well-known financial risk measurements (Herfindahl-

Hirschmann index)

28

slide-29
SLIDE 29

Security goals

  • The auditor and non-involved parties cannot see

transaction participants or amounts

  • Banks cannot lie to the auditor or omit transactions
  • Banks cannot violate financial invariants

– Honest banks can always convince the auditor of a correct answer

  • A malicious bank cannot block other banks from

transacting

29

slide-30
SLIDE 30

Threat model

Banks might attempt to steal or hide assets, manipulate balances, or lie to the auditor Banks can arbitrarily collude Banks or the auditor might try to learn transaction contents Out of scope: A ledger that omits transactions or is unavailable An adversary watching network traffic Banks leaking their own transactions

30

slide-31
SLIDE 31

Outline

  • System & threat model
  • zkLedger design

– Pedersen commitments – Ledger table format – Zero-knowledge proofs

  • Evaluation

31

slide-32
SLIDE 32

Example public transaction ledger

32

ID Asset From To Amount 1 € Depositor Goldman Sachs 30,000,000 2 € Goldman Sachs JP Morgan 10,000,000 3 € JP Morgan Barclays 1,000,000 4 € JP Morgan Barclays 2,000,000

slide-33
SLIDE 33

Depositor injects assets to the ledger

33

ID Asset From To Amount 1 € Depositor Goldman Sachs 30,000,000 2 € Goldman Sachs JP Morgan 10,000,000 3 € JP Morgan Barclays 1,000,000 4 € JP Morgan Barclays 2,000,000

slide-34
SLIDE 34

ID Asset From To Amount 1 € Depositor Goldman Sachs 30,000,000 2 € Goldman Sachs JP Morgan 10,000,000 3 € JP Morgan Barclays 1,000,000 4 € JP Morgan Barclays 2,000,000

Goals: auditing + privacy

34

Goals:

  • Provably audit Barclays to find Euro holdings
  • Hide participants, amounts, and transaction graph
slide-35
SLIDE 35

Hide amounts with commitments

35

ID Asset From To Amount 1 € Depositor Goldman Sachs 30M 2 € Goldman Sachs JP Morgan comm(10M) 3 € JP Morgan Barclays comm(1M) 4 € JP Morgan Barclays comm(2M)

= comm(13M)

Γ— Γ—

slide-36
SLIDE 36

Hide participants with other techniques

36

ID Asset From To Amount 1 € Depositor Goldman Sachs 30M 2 € Goldman Sachs JP Morgan comm(10M) 3 € JP Morgan Barclays comm(1M) 4 € JP Morgan Barclays comm(2M)

slide-37
SLIDE 37

Strawman: audit by opening up combined commitments

37

How many Euros do you hold?

3 million

Barclays

Open comm(1M) Γ— comm(2M) to 3M ID Asset From To Amount 1 € Depositor Goldman Sachs 30M 2 € Goldman Sachs JP Morgan comm(10M) 3 € JP Morgan Barclays comm(1M) 4 € JP Morgan Barclays comm(2M)

Auditor

Reveals transactions

Problems?

slide-38
SLIDE 38

How many Euros do you hold?

1 million

Barclays

ID Asset From To Amount 1 € Depositor Goldman Sachs 30M 2 € Goldman Sachs JP Morgan comm(10M) 3 € JP Morgan Barclays comm(1M) 4 € JP Morgan Barclays comm(2M)

Auditor

A malicious bank could omit transactions

38

Open comm(1M) to 1M

slide-39
SLIDE 39

ID Asset From To Amount 1 € Depositor Goldman Sachs 30M 2 € Goldman Sachs JP Morgan comm(10M) 3 € JP Morgan Barclays comm(1M) 4 € JP Morgan Barclays comm(2M)

A malicious bank could omit transactions

39

slide-40
SLIDE 40

zkLedger design: an entry for every bank in every transaction

40

ID Asset Goldman Sachs JP Morgan Barclays 1 € Depositor, Goldman Sachs, 30M 2 € comm(-10M) comm(10M) comm(0) 3 € comm(0) comm(-1M) comm(1M) 4 € comm(0) comm(-2M) comm(2M)

Spender’s column commits to negative value, receiver’s positive value For non-involved banks, entries commit to 0 Indistinguishable from commitments to non-zero values Depositor transactions are public

slide-41
SLIDE 41

Key insight: auditor audits every transaction

41

How many Euros do you hold?

Barclays

ID Asset Goldman Sachs JP Morgan Barclays 1 € Depositor, Goldman Sachs, 30M 2 € comm(-10M) comm(10M) comm(0) 3 € comm(0) comm(-1M) comm(1M) 4 € comm(0) comm(-2M) comm(2M)

3 million

Open [ comm(0) Γ— comm(1M) Γ— comm(2M)] to 3M

Auditor

slide-42
SLIDE 42

A malicious bank can’t produce a proof for a different answer

42

How many Euros do you hold?

Barclays

ID Asset Goldman Sachs JP Morgan Barclays 1 € Depositor, Goldman Sachs, 30M 2 € comm(-10M) comm(10M) comm(0) 3 € comm(0) comm(-1M) comm(1M) 4 € comm(0) comm(-2M) comm(2M) Open comm(1M)to 1M

1 million

Auditor

slide-43
SLIDE 43

Security goals

  • The auditor and non-involved parties cannot see

transaction participants, amounts, or transaction graph

  • Banks cannot lie to the auditor or omit transactions
  • Banks cannot violate financial invariants

– Honest banks can always convince the auditor of a correct answer

  • A malicious bank cannot block other banks from

transacting

45

slide-44
SLIDE 44

How to maintain financial invariants?

46

ID Asset Goldman Sachs JP Morgan Barclays 1 € Depositor, Goldman Sachs, 30M 2 € comm(-10M) comm(10M) comm(0) 3 € comm(0) comm(-1M) comm(1M) 4 € comm(0) comm(-2M) comm(2M)

use non-interactive zero-knowledge proofs (NIZKs)!

comm(𝑑𝑗𝑕45) comm(𝑑𝑗𝑕67) comm(𝑑𝑗𝑕67)

slide-45
SLIDE 45

What are the NIZK proof statements?

47

ID Asset Goldman Sachs JP Morgan Barclays 1 € Depositor, Goldman Sachs, 30M 2 € comm(-10M) comm(10M) comm(0) 3 € comm(0) comm(-1M) comm(1M) 4 € comm(0) comm(-2M) comm(2M)

Sender proves in zero knowledge that it knows sk for signing, values committed to in row, and decommitment randomness for all of them such that :

  • Values in the transaction row sum to zero
  • Signature verifies with the PK of sending bank on that amount
  • One bank receives, all others are zero
  • Bank has assets to transfer from previous transactions

comm(𝑑𝑗𝑕45) comm(𝑑𝑗𝑕67) comm(𝑑𝑗𝑕67)

slide-46
SLIDE 46

Preliminaries

  • Anyone can compute the aggregate commitment for every bank 𝑗

(over all transactions including this new transaction): 𝑑𝑝𝑛𝑛*++,-

  • Let π‘œ be the number of banks
  • 𝑑𝑝𝑛𝑛./# contains the signature on the transaction
  • Let 𝑄𝐿- be the verification key of bank 𝑗 with signing key 𝑇𝐿-
  • Assume that the receiver obtains the decommitment values from

the spender using an out-of-band channel

48

slide-47
SLIDE 47

in

The spender proves in zero-knowledge that it knows

  • 𝑑 the index of spending bank, β„“ the index of receiving bank,
  • decommitment values 𝑠

" and values 𝑀"

  • signature randomness 𝑠 and 𝑑𝑙,
  • 𝑠

#$$, 𝑀#$$ for 𝑑𝑝𝑛𝑛#$$,&,

such that:

  • 𝑑𝑝𝑛𝑛" opens up with 𝑠

" and 𝑀",

  • 𝑀'() 𝑗𝑑 𝑑𝑗𝑕 produced with 𝑠, 𝑑𝑙 and 𝑑𝑗𝑕 verifies with 𝑄𝐿& on transaction

content [transaction is authorized]

  • 𝑀& ≀ 0, 𝑀& = βˆ’π‘€β„“,

𝑀" = 0 for 𝑗 ∈ 1, π‘œ β‰  β„“, 𝑑, [spender loses money, receiver gains same money, the rest have zero]

  • 𝑑𝑝𝑛𝑛#$$,& opens up with 𝑠

#$$ and 𝑀#$$ and 𝑀#$$ β‰₯ 0

[spender spends no more than resources]

49

Instead of one monolithic proof enforcing these properties, zkLedger does a set of more efficient things but they are less relevant here

slide-48
SLIDE 48

Outline

  • System model
  • zkLedger design

– Hiding commitments – Ledger table format – Zero-knowledge proofs

  • Evaluation

50

slide-49
SLIDE 49

Implementation

  • zkLedger written in Go
  • Elliptic curve library: btcec, secp256k1
  • ~4000 loc

51

slide-50
SLIDE 50

Evaluation

  • How fast is auditing?
  • How does zkLedger scale with the number of banks?

Experiments on 12 4 core Intel Xeon 2.5Ghz VMs, 24 GB RAM

52

slide-51
SLIDE 51

Simple auditing is fast and independent of ledger size

53

2 4 6 8 10 12 0K 20K 40K 60K 80K 100K Auditing time (ms) Transactions in ledger

  • nline auditor

Auditing 4 banks measuring market concentration Pedersen commitments + table design amenable to caching

slide-52
SLIDE 52

Cost in a transaction per bank

  • Entry size: 4.5KB
  • Creating an entry: 8ms
  • Verifying an entry: 7ms

57

Γ— # banks

Highly parallelizable Significant opportunities for compression and speedup

slide-53
SLIDE 53

Summary

  • Specialized/partial homomorphic encryption enables

specific functionalities and tend to be faster than FHE at computing these

  • Pedersen commitment is also homomorphic
  • zkLedger provides privacy and auditing on transaction

ledgers using Pedersen commitments, their homomorphism and NIZKs

58