Class alice_elgamal
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_veugen
edu.fiu.adwise.homomorphic_encryption.socialistmillionaire.alice_elgamal
- All Implemented Interfaces:
CipherConstants,alice_interface
Represents Alice's implementation of the ElGamal protocol for secure computation.
This class extends the `alice_veugen` class and provides methods for performing
arithmetic operations and secure comparisons using the ElGamal encryption scheme.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPerforms addition on two encrypted values from alice.division(ElGamal_Ciphertext x, long d) Performs division on an encrypted value x from alice by a given divisor from bob.getKMin(List<ElGamal_Ciphertext> input, int k) Retrieves the k smallest encrypted values from a list.Performs multiplication on two encrypted values.booleanSee the paper Correction to "Improving the DGK comparison protocol", this implements Protocol 3.Methods inherited from class edu.fiu.adwise.homomorphic_encryption.socialistmillionaire.alice_veugen
Protocol1, Protocol2Methods 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_elgamal
public alice_elgamal()Constructs an instance of `alice_elgamal`.
-
-
Method Details
-
addition
public ElGamal_Ciphertext addition(ElGamal_Ciphertext x, ElGamal_Ciphertext y) throws IOException, ClassNotFoundException, IllegalArgumentException Performs addition on two encrypted values from alice.- Parameters:
x- the first encrypted value.y- the second encrypted value.- Returns:
- the encrypted result of the addition.
- Throws:
IOException- if an I/O error occurs during communication.ClassNotFoundException- if a class cannot be found during deserialization.IllegalArgumentException- if invalid arguments are provided.
-
multiplication
public ElGamal_Ciphertext multiplication(ElGamal_Ciphertext x, ElGamal_Ciphertext y) throws IOException, ClassNotFoundException, IllegalArgumentException Performs multiplication on two encrypted values. Use a multi-party protocol if alice provides two additive El-Gamal encrypted values- Parameters:
x- the first encrypted value.y- the second encrypted value.- Returns:
- the encrypted result of the multiplication.
- Throws:
IOException- if an I/O error occurs during communication.ClassNotFoundException- if a class cannot be found during deserialization.IllegalArgumentException- if invalid arguments are provided.
-
division
public ElGamal_Ciphertext division(ElGamal_Ciphertext x, long d) throws IOException, ClassNotFoundException, IllegalArgumentException, HomomorphicException Performs division on an encrypted value x from alice by a given divisor from bob.- Parameters:
x- the encrypted value to divide.d- the divisor.- Returns:
- the encrypted result of the division.
- Throws:
IOException- if an I/O error occurs during communication.ClassNotFoundException- if a class cannot be found during deserialization.IllegalArgumentException- if invalid arguments are provided.HomomorphicException- if the ElGamal keys do not support additive operations.
-
Protocol4
public boolean Protocol4(ElGamal_Ciphertext x, ElGamal_Ciphertext y) throws IOException, ClassNotFoundException, HomomorphicException See the paper Correction to "Improving the DGK comparison protocol", this implements Protocol 3. This is an improved version of Protocol 1, initially created by DGK, see original bob class This executes a protocol comparing two encrypted ElGamal values- 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.ClassNotFoundException- if a class cannot be found during deserialization.HomomorphicException- if an error occurs during the protocol execution.
-
getKMin
public List<ElGamal_Ciphertext> getKMin(List<ElGamal_Ciphertext> input, int k) throws ClassNotFoundException, IOException, IllegalArgumentException, HomomorphicException Retrieves the k smallest encrypted values from a list.- Parameters:
input- the list of encrypted values.k- the number of smallest values to retrieve.- Returns:
- a list of the k smallest encrypted values.
- Throws:
ClassNotFoundException- if a class cannot be found during deserialization.IOException- if an I/O error occurs during communication.IllegalArgumentException- if the value ofkis invalid.HomomorphicException- if an error occurs during the sorting process.
-