All Implemented Interfaces:
CipherConstants, alice_interface

public class alice_joye extends alice
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
  • Constructor Details

    • alice_joye

      public alice_joye()
      Default constructor for the `alice_joye` class.
  • Method Details

    • Protocol2

      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:
      Protocol2 in interface alice_interface
      Overrides:
      Protocol2 in class alice
      Parameters:
      x - the first encrypted value.
      y - the second encrypted value.
      Returns:
      true if x >= y, false otherwise.
      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:
      Protocol1 in interface alice_interface
      Overrides:
      Protocol1 in class alice
      Parameters:
      x - the encrypted value to compare.
      Returns:
      true if x <= y, false otherwise.
      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

      public List<Integer> form_set_l(BigInteger x, int delta_a, BigInteger[] XOR)
      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

      public static int compute_delta_a(BigInteger x, int t_bits) throws HomomorphicException
      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

      public static int hamming_weight(BigInteger value) throws HomomorphicException
      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.