|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSFE.BOAL.Circuit
public class Circuit
This class holds the data structures and methods used for garbeled circuit preparation.
For the l'th gate, we generate garbeled output description values
U(l,0) U(l,1) C(l)
Where U(l,0) is an 79-bit random number representing the output value 0 of the
l'th fate. Likewise, U(l,1) represents 1 on this wire; and C(l) is one bit
representing a permutation on {0,1}.
Note: an input line is simply a gate with no input or computation.
Output description values for all lines are kept in a vector of gates implemented by the Gates class.
Let an input line l be as follows:
l gate n i1 .. in o0 o1 .. o((2^n)-1)
// outputs of inputs 00...0 , 00..01 through 11..11
Let F be a strong hash function such as SHA-1. Let || denote a concatanation operation.
We then generate a garbeled circuit for line l as follows:
l gate n i1 .. in [enumeration of (2^n-1) garbeled outputs]
In the output above, we first repeat inputs, so that the computing-side will know where to take them from
We then output garbeled output values, enumerated by the permuted input values.
That is, starting from (00..00) = (c1c2..cn), let:
vk = (C(ik) XOR ck)
, k=1..n
let j be the binary index corresponding to (v1 v2.. vn)
We encode the output value oj as follows:
( U(l,oj) || ( oj xor C(l) ) ) xor F( U(i1,v1) || U(i2,v2) || ... ||
U(in,vn))
This continues until we enumerate all (2^n)-1 combination of (c1 c2 .. cn)
Constructor Summary | |
---|---|
Circuit()
|
Method Summary | |
---|---|
Gate |
addGate(int n_ins,
int type,
boolean out_gate)
Add a new gate with the specified number of input wires to the gates vector. |
byte[] |
cextractEncPayload(int total_size)
Extract encrypyed payload from an encrypted circuit (for the purpose of communicating it in minimal overhead). |
byte[] |
cextractSecPayload(int total_size)
Extract secret payload from an encrypted circuit (for the purpose of communicating it in minimal overhead). |
void |
cinjectEncPayload(byte[] info)
Inject encrypyed payload into a circuit. |
void |
cinjectSecPayload(byte[] info)
Inject secret payload into a circuit. |
int |
cmeasureEncPayload()
Measure size of encrypted payload in an encrypted circuit |
int |
cmeasureSecPayload()
Measure size of secret payload in an encrypted circuit |
void |
evalCircuit()
Evaluate a circuit |
void |
evalGarbledCircuit(boolean alice_interpret,
boolean bob_interpret)
Evaluate a garbled circuit |
void |
generateEncCircuit()
Turn all gates in a circuit to encrypted gates |
Gate |
getGate(int gate_num)
Get a gate from a circuit |
boolean |
isCorrect()
Verify that an exposed garbled circuit is correct (done by Alice in order to prevent cheating by Bob). |
void |
printCircuit()
For debugging purposes. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Circuit()
Method Detail |
---|
public Gate addGate(int n_ins, int type, boolean out_gate)
n_ins
- the number of input wires of the gate.type
- the type of gate (e.g., regular/input/output)
public Gate getGate(int gate_num)
public void generateEncCircuit()
public int cmeasureEncPayload()
public byte[] cextractEncPayload(int total_size)
total_size
- total size of the circuit's payload in bytes.
public void cinjectEncPayload(byte[] info)
info
- byte array with data to injectpublic int cmeasureSecPayload()
public byte[] cextractSecPayload(int total_size)
total_size
- total size of the circuit's payload in bytes.
public void cinjectSecPayload(byte[] info)
info
- byte array with data to injectpublic boolean isCorrect()
public void evalCircuit()
public void evalGarbledCircuit(boolean alice_interpret, boolean bob_interpret)
alice_interpret
- - interpret Alice garbled outputsbob_interpret
- - interpret Bob garbled outputspublic void printCircuit()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |