Computing on Encrypted Data - Computer Science

40
Computing on Encrypted Data Secure Internet of Things Seminar David Wu January, 2015

Transcript of Computing on Encrypted Data - Computer Science

Page 1: Computing on Encrypted Data - Computer Science

Computing on Encrypted Data

Secure Internet of Things Seminar

David Wu

January, 2015

Page 2: Computing on Encrypted Data - Computer Science

New Applications in the Internet of Things

Smart Homes

report energy consumption

aggregation + analytics

usage statistics and reports

Page 3: Computing on Encrypted Data - Computer Science

The Power of the Cloud

BIG DATA

analyticsrecommendations

personalization

lots of user information = big

incentives

Question: provide service, preserve

privacy

Page 4: Computing on Encrypted Data - Computer Science

Secure Multiparty Computation (MPC)

Multiple parties want to compute a joint function on private inputs

private input: individual power consumption

at end of computation, each party learns the

average power consumption

privacy guarantee: no party learns anything extra about

other parties’ inputs

Page 5: Computing on Encrypted Data - Computer Science

Two Party Computation (2PC)

β€’ Simpler scenario: two-party computation (2PC)

β€’ 2PC: Mostly β€œsolved” problem: Yao’s circuits [Yao82]β€’ Express function as a Boolean circuit

garbled version ofcircuit

oblivious transfer to obtain garbled inputs

output of garbled circuit

Party A Party B

Page 6: Computing on Encrypted Data - Computer Science

Two-Party Computation (2PC)

β€’ Yao’s circuits very efficient and heavily optimized [KSS09]β€’ Evaluating circuits with 1.29 billion gates in 18 minutes (1.2

gates / Β΅s) [ALSZ13]

β€’ Yao’s circuit provides semi-honest security: malicious security via cut-and-choose, but not as efficient

Page 7: Computing on Encrypted Data - Computer Science

Going Beyond 2PC

β€’ General MPC also β€œsolved” [GMW87]

secret share inputs with all parties

jointly evaluate circuit, gate-by-gate

Page 8: Computing on Encrypted Data - Computer Science

Secure Multiparty Computation

β€’ General MPC suffices to evaluate arbitrary functions amongst many parties: should be viewed as a feasibilityresult

β€’ Limitations of general MPCβ€’ many rounds of communication / interactionβ€’ possibly large bandwidthβ€’ hard to coordinate interactions with large number of parties

β€’ Other considerations (not discussed): fairness, guaranteeing output delivery

Page 9: Computing on Encrypted Data - Computer Science

This Talk: Homomorphic Encryption

Interaction

GMW Protocol and General MPC

Homomorphic Encryption

Custom Protocols

Many rounds of interactionBoolean circuits (typically)

Few rounds of interactionArithmetic circuits

General methods for secure computation

Page 10: Computing on Encrypted Data - Computer Science

Homomorphic Encryption

Homomorphic encryption scheme: encryption scheme that allows computation on ciphertexts

Comprises of three functions:

Encm

c

pk

c

Decm

sk

Must satisfy usual notion of semantic security

Page 11: Computing on Encrypted Data - Computer Science

Homomorphic Encryption

Homomorphic encryption scheme: encryption scheme that allows computation on ciphertexts

Comprises of three functions:

Decπ‘ π‘˜ Eva𝑙𝑓 π‘’π‘˜, 𝑐1, 𝑐2 = 𝑓 π‘š1, π‘š2

𝑐1 = Encπ‘π‘˜(π‘š1)

Eval𝑓𝑐3

𝑐2 = Encπ‘π‘˜(π‘š2)

π‘’π‘˜

Page 12: Computing on Encrypted Data - Computer Science

Fully Homomorphic Encryption (FHE)

Many homomorphic encryption schemes:β€’ ElGamal: 𝑓 π‘š0, π‘š1 = π‘š0π‘š1

β€’ Paillier: 𝑓 π‘š0, π‘š1 = π‘š0 + π‘š1

Fully homomorphic encryption: homomorphic with respect to two operations: addition and multiplication

β€’ [BGN05]: one multiplication, many additionsβ€’ [Gen09]: first FHE construction from lattices

Page 13: Computing on Encrypted Data - Computer Science

Privately Outsourcing Computation

encrypted data

encrypted results of computation

Leveraging computational power

of the cloud

Page 14: Computing on Encrypted Data - Computer Science

Machine Learning in the Cloud

report energy consumption

aggregation + analytics

1. Publish public key

2. Upload encrypted values

3. Compute model homomorphically

4. Decrypt to obtain model

Page 15: Computing on Encrypted Data - Computer Science

Machine Learning in the Cloud

β€’ Passive adversary sitting in the cloud does not see client data

β€’ Power company only obtains resulting model, not individual data points (assuming no collusion)

β€’ Parties only need to communicate with cloud (the power of public-key encryption)

Page 16: Computing on Encrypted Data - Computer Science

Big Data, Limited Computation

β€’Homomorphic encryption is expensive, especially compared to symmetric primitives such as AES

β€’Can be unsuitable for encrypting large volumes of data

Page 17: Computing on Encrypted Data - Computer Science

β€œHybrid” Homomorphic Encryption

Encπ‘π‘˜ π‘˜ , AESπ‘˜ π‘šHomomorphically evaluate the AES decryption circuit

AESπ‘˜ π‘š Encπ‘π‘˜ AESπ‘˜ π‘š

Encπ‘π‘˜ π‘˜ Encπ‘π‘˜ π‘š

encrypt

evaluate AES decryption

Encπ‘π‘˜ 𝑓 π‘š

homomorphic evaluation

Encrypt AES key using homomorphic encryption

(expensive), encrypt data using AES (cheap)

Current performance: β‰ˆ 400 seconds to decrypt 120 AES-128 blocks (4 s/block)

[GHS15]

Page 18: Computing on Encrypted Data - Computer Science

Constructing FHE

β€’ FHE: can homomorphically compute arbitrary number of operations

β€’Difficult to construct – start with something simpler:somewhat homomorphic encryption scheme (SWHE)

β€’ SWHE: can homomorphically evaluate a few operations (circuits of low depth)

Page 19: Computing on Encrypted Data - Computer Science

Gentry’s Blueprint: SWHE to FHE

β€’Gentry described general bootstrapping method of achieving FHE from SWHE [Gen’09]

β€’ Starting point: SWHE scheme that can evaluate its own decryption circuit

Page 20: Computing on Encrypted Data - Computer Science

Gentry’s Blueprint: From SWHE to FHE

Homomorphism Remaining

many operations remaining

no operations remaining

π‘šπ‘š

ciphertext

π‘ π‘˜

encryption of secret key

encrypt the ciphertext

π‘š

homomorphically evaluate the decryption function

recryptfunctionality

Page 21: Computing on Encrypted Data - Computer Science

Bootstrappable SWHE

β€’ First bootstrappable construction by Gentry based on ideal lattices [Gen09]

β€’ Tons of progress in constructions of FHE in the ensuing years [vDGHV10, SV10, BV11a, BV11b, Bra12, BGV12, GHS12, GSW13], and more!

β€’ Have been simplified enough that the description can fit in a blog post [BB12]

Page 22: Computing on Encrypted Data - Computer Science

Conceptually Simple FHE [GSW13]

β€’ Ciphertexts are 𝑛 Γ— 𝑛 matrices over β„€π‘ž

β€’ Secret key is a vector 𝑣 ∈ β„€π‘žπ‘›

𝐢 𝑣× = π‘š 𝑣× 𝑒+

ciphertext secret key message noise

Encryption of π‘š satisfies above relation

𝑣 is a β€œnoisy” eigenvector of 𝐢

Page 23: Computing on Encrypted Data - Computer Science

Conceptually Simple FHE [GSW13]

β€’ Suppose that 𝑣 has a β€œlarge” component 𝑣𝑖

β€’ Can decrypt as follows:

𝐢𝑖 , 𝑣

𝑣𝑖=

π‘šπ‘£π‘– + 𝑒𝑖

𝑣𝑖= π‘š

𝐢 𝑣× = π‘š 𝑣× 𝑒+

ciphertext secret key message noise

𝐢𝑖 is 𝑖th row of 𝐢 Relation holds if

𝑒𝑖

𝑣𝑖<

1

2

Page 24: Computing on Encrypted Data - Computer Science

Conceptually Simple FHE [GSW13]

Homomorphic addition

𝐢1 𝑣× = π‘š1 𝑣× 𝑒1+ 𝐢2 𝑣× = π‘š2 𝑣× 𝑒2+

𝐢1 + 𝐢2 𝑣× = π‘š1 + π‘š2 𝑣× 𝑒1+ 𝑒2+

homomorphic addition is matrix addition

noise terms also add

Page 25: Computing on Encrypted Data - Computer Science

Conceptually Simple FHE [GSW13]

Homomorphic multiplication

𝐢1 𝑣× = π‘š1 𝑣× 𝑒1+ 𝐢2 𝑣× = π‘š2 𝑣× 𝑒2+

𝐢1𝐢2 𝑣 = π‘š1π‘š2 𝑣 + 𝐢1𝑒2 + π‘š2𝑒1

homomorphic multiplication is matrix multiplication noise could blow up if

𝐢1 or π‘š2 are not small

Page 26: Computing on Encrypted Data - Computer Science

Conceptually Simple FHE [GSW13]

β€’Basic principles: ciphertexts are matrices, messages are approximate eigenvalues

β€’Homomorphic operations correspond to matrix addition and multiplication (and some tricks to constrain noise)

β€’Hardness based on learning with errors (LWE) [Reg05]

Page 27: Computing on Encrypted Data - Computer Science

The Story so Far…

β€’ Simple FHE schemes exist

β€’ But… bootstrapping is expensive!β€’ At 76 bits of security: each bootstrapping operation requires 320

seconds and 3.4 GB of memory [HS14]β€’ Other implementations exist, but generally less flexible / efficient

β€’ SWHE (without bootstrapping) closer to practical: can evaluate shallow circuits

Page 28: Computing on Encrypted Data - Computer Science

Application: Statistical Analysis

β€’ Consider simple statistical models: computing the mean or covariance (for example, average power consumption)

β€’ Problem: given 𝑛 vectors π‘₯1, … , π‘₯𝑛, compute

β€’ Mean: πœ‡ =1

𝑛 𝑖=1

𝑛 π‘₯𝑖

β€’ Covariance: Σ𝑋 =1

𝑛2(𝑛𝑋𝑇𝑋 βˆ’

Page 29: Computing on Encrypted Data - Computer Science

Application: Statistical Analysis

β€’ Can also perform linear regression: given design matrix 𝑋 and response vector 𝑦, evaluate normal equations

πœƒ = 𝑋𝑇𝑋 βˆ’1𝑋𝑇𝑦

β€’ Matrix inversion (over β„š) using Cramer’s rule

β€’ Depth 𝑛 for 𝑛-dimensional data

Page 30: Computing on Encrypted Data - Computer Science

Batch Computation [SV11]

Algebraic structure of some schemes enable encryption + operations on vectors at no extra cost

Plaintext Space: ring 𝑅

𝑅𝔭1𝑅𝔭2

β‹― π‘…π”­π‘˜

Chinese Remainder Theorem: 𝑅 β‰…βŠ—π‘–=1π‘˜ 𝑅𝔭𝑖

Page 31: Computing on Encrypted Data - Computer Science

Batch Computation [SV11]

Encrypt + process array of values at no extra cost:

1 2 3 4

7 5 3 1

+

8 7 6 5

In practice: β‰₯ 5000 slots

One homomorphic operation

Page 32: Computing on Encrypted Data - Computer Science

2025303540455055606570

2,000 20,000 200,000 2,000,000

Tim

e (

min

ute

s)

Number of Datapoints

Time to Compute Mean and Covariance over Encrypted Data (Dimension 4)

Multiplications dominate

Few ciphertexts due to batching

Based on implementation of Brakerski’s scheme [Bra12]

Page 33: Computing on Encrypted Data - Computer Science

0

10

20

30

40

50

60

70

80

1000 10000 100000 1000000

Tim

e (

min

ute

s)

Number of Datapoints

Time to Perform Linear Regression on Encrypted Data(2 Dimensions)

Few ciphertexts due to batching

Multiplications dominate

Page 34: Computing on Encrypted Data - Computer Science

Application: Private Information Retrieval

I want to see record 𝑖…

???

PIR protocol

client learns record 𝑖, server learns nothing

cloud database

Page 35: Computing on Encrypted Data - Computer Science

PIR from Homomorphic Encryption [KO97]

𝑣11 𝑣12 𝑣13

𝑣21 𝑣22 𝑣23

𝑣31 𝑣32 𝑣33

100

represent database as matrix

query is an encrypted basis

vector

Γ—

𝑣11

𝑣21

𝑣31

=

server evaluates inner product

response

database components in the clear: additive homomorphism suffices

𝑂( 𝑛)communication

Page 36: Computing on Encrypted Data - Computer Science

PIR from Homomorphic Encryption

β€’ 𝑂 𝑛 communication with additive homomorphism aloneβ€’ Naturally generalizes:

β€’ 𝑂 3 𝑛 with one multiplication

β€’ 𝑂 π‘˜ 𝑛 with degree π‘˜ βˆ’ 1 -homomorphism

β€’ Benefits tremendously from batching

database

π‘Ÿ1, … , π‘Ÿπ‘π‘Ÿ1, … , π‘Ÿπ‘/3

π‘Ÿ1+𝑁/3, … , π‘Ÿ2𝑁/3

π‘Ÿ1+2𝑁/3, … , π‘Ÿπ‘

split database into many small

databases, query in parallel

Page 37: Computing on Encrypted Data - Computer Science

1

10

100

1,000

10,000

100,000

1,000,000

1 10 100 1000 10000

Re

spo

nse

Tim

e (

s)

Number of Records (Millions)

FHE-PIR Timing Results (5 Mbps)

FHE-PIR (d = 2) FHE-PIR (d = 3) FHE-PIR (d = 4) Trivial PIR

Page 38: Computing on Encrypted Data - Computer Science

PIR from Homomorphic Encryption

β€’ Outperforms trivial PIR for very large databases

β€’ However, recursive KO-PIR with additive homomorphism is still state-of-the-art

Page 39: Computing on Encrypted Data - Computer Science

Concluding Remarksβ€’ Internet of Things brings many security challenges

β€’ Many generic cryptographic tools: 2PC, MPC, FHE

β€’ 2PC/MPC work well for small number of parties

β€’ SWHE/FHE preferable with many parties (IoT scale)

β€’ FHE still nascent technology – should be viewed as a β€œproof-of-concept” rather than practical solution

β€’ SWHE closer to practical, suitable for evaluating simple (low-depth) functionalities

β€’ Big open problem to develop more practical constructions!

Page 40: Computing on Encrypted Data - Computer Science

Questions?