Class alice_joye
java.lang.Object
edu.fiu.adwise.homomorphic_encryption.socialistmillionaire.socialist_millionaires
edu.fiu.adwise.homomorphic_encryption.socialistmillionaire.alice
edu.fiu.adwise.homomorphic_encryption.socialistmillionaire.alice_joye
- All Implemented Interfaces:
CipherConstants,alice_interface
Represents Alice's implementation of the Joye and Salehi protocol for secure computation.
This class extends the base `alice` class and provides methods for secure comparison
and related cryptographic operations using homomorphic encryption.
See the paper "Private yet Efficient Decision Tree Evaluation"
paper link
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompute_c(BigInteger x, BigInteger[] Encrypted_Y, BigInteger[] XOR, int delta_a, List<Integer> set_l) Computes the array of encrypted values (C) used in the Joye protocol.static intcompute_delta_a(BigInteger x, int t_bits) Computes the delta value (delta_a) for Alice based on the Hamming weight of the input.form_set_l(BigInteger x, int delta_a, BigInteger[] XOR) Forms the set of indices (L) used in the Joye and Salehi protocol.static inthamming_weight(BigInteger value) Computes the Hamming weight of a given value.booleanExecutes Protocol 1 for secure comparison of a single unencrypted value with another unencrypted value from Bob.booleanProtocol2(BigInteger x, BigInteger y) Executes Protocol 2 for secure comparison between two encrypted values.Methods inherited from class edu.fiu.adwise.homomorphic_encryption.socialistmillionaire.alice
division, encrypted_equals, encrypted_xor, getKValues, getKValues, multiplication, private_equals, receivePublicKeys, set_dgk_private_key, set_socketMethods inherited from class edu.fiu.adwise.homomorphic_encryption.socialistmillionaire.socialist_millionaires
get_bytes_sent, getDGKPublicKey, getElGamalPublicKey, getPaillierPublicKey, isDGK, readBoolean, readInt, readObject, setDGKMode, setDGKPublicKey, setElGamalPublicKey, setPaillierPublicKey, writeBoolean, writeInt, writeObject
-
Constructor Details
-
alice_joye
public alice_joye()Default constructor for the `alice_joye` class.
-
-
Method Details
-
Protocol2
public boolean Protocol2(BigInteger x, BigInteger y) throws IOException, HomomorphicException, ClassNotFoundException Executes Protocol 2 for secure comparison between two encrypted values. This protocol involves multiple steps, including randomization, XOR computation, and secure communication with Bob.- Specified by:
Protocol2in interfacealice_interface- Overrides:
Protocol2in classalice- Parameters:
x- the first encrypted value.y- the second encrypted value.- Returns:
trueifx >= y,falseotherwise.- Throws:
IOException- if an I/O error occurs during communication.HomomorphicException- if an error occurs during homomorphic operations.ClassNotFoundException- if a class cannot be found during deserialization.
-
Protocol1
public boolean Protocol1(BigInteger x) throws HomomorphicException, IOException, ClassNotFoundException Executes Protocol 1 for secure comparison of a single unencrypted value with another unencrypted value from Bob. This protocol computes the XOR of the input value with encrypted bits and performs secure communication with Bob.- Specified by:
Protocol1in interfacealice_interface- Overrides:
Protocol1in classalice- Parameters:
x- the encrypted value to compare.- Returns:
trueifx <= y,falseotherwise.- Throws:
IOException- if an I/O error occurs during communication.HomomorphicException- if an error occurs during homomorphic operations.ClassNotFoundException- if a class cannot be found during deserialization.
-
compute_c
public BigInteger[] compute_c(BigInteger x, BigInteger[] Encrypted_Y, BigInteger[] XOR, int delta_a, List<Integer> set_l) throws HomomorphicException Computes the array of encrypted values (C) used in the Joye protocol. This method combines XOR results, encrypted bits, and other parameters to generate the required encrypted values.- Parameters:
x- the plaintext value.Encrypted_Y- the array of encrypted bits.XOR- the XOR results of the plaintext and encrypted bits.delta_a- the delta value for Alice.set_l- the set of indices used in the computation.- Returns:
- an array of encrypted values (C).
- Throws:
HomomorphicException- if an error occurs during homomorphic operations.
-
form_set_l
Forms the set of indices (L) used in the Joye and Salehi protocol. This method ensures that the size of the set matches the required threshold to protect against timing attacks.- Parameters:
x- the plaintext value.delta_a- the delta value for Alice.XOR- the XOR results of the plaintext and encrypted bits.- Returns:
- a list of indices forming the set L.
-
compute_delta_a
Computes the delta value (delta_a) for Alice based on the Hamming weight of the input. This method ensures that the delta value is selected securely and consistently.- Parameters:
x- the plaintext value.t_bits- the number of bits to consider.- Returns:
- the computed delta value (delta_a).
- Throws:
HomomorphicException- if an error occurs during the computation.
-
hamming_weight
Computes the Hamming weight of a given value. The Hamming weight is the number of 1 bits in the binary representation of the value.- Parameters:
value- the value whose Hamming weight is to be computed.- Returns:
- the Hamming weight of the value.
- Throws:
HomomorphicException- if the value is negative.
-