Interface alice_interface
- All Known Implementing Classes:
alice,alice_elgamal,alice_joye,alice_veugen
public interface alice_interface
Interface defining the operations for Alice in the Socialist Millionaires' Problem (SMP) protocol.
This interface includes methods for secure multi-party computation using homomorphic encryption.
-
Method Summary
Modifier and TypeMethodDescriptiondivision(BigInteger x, long d) Performs division on an encrypted integer.booleanCompares two encrypted integers for equality.getKValues(BigInteger[] input, int k, boolean biggest_first) Retrieves the k largest or smallest values from an array of encrypted integers.getKValues(List<BigInteger> input, int k, boolean smallest_first) Retrieves the k largest or smallest values from a list of encrypted integers.Performs multiplication on two encrypted integers.booleanCompares Alice's private integer with Bob's private integer.booleanProtocol2(BigInteger x, BigInteger y) Compares two encrypted integers and determines if the first is greater than or equal to the second.voidReceives public keys from the other party.voidset_socket(Socket socket) Sets the socket for communication.
-
Method Details
-
encrypted_equals
boolean encrypted_equals(BigInteger x, BigInteger y) throws HomomorphicException, IOException, ClassNotFoundException Compares two encrypted integers for equality.- Parameters:
x- the first encrypted integer.y- the second encrypted integer.- Returns:
- true if the integers are equal, false otherwise.
- Throws:
HomomorphicException- if a homomorphic encryption error occurs.IOException- if an I/O error occurs.ClassNotFoundException- if the class of a serialized object cannot be found.
-
Protocol1
boolean Protocol1(BigInteger x) throws IOException, IllegalArgumentException, HomomorphicException, ClassNotFoundException Compares Alice's private integer with Bob's private integer.- Parameters:
x- Alice's private integer.- Returns:
- true if the comparison satisfies the protocol, false otherwise.
- Throws:
IOException- if an I/O error occurs.IllegalArgumentException- if an invalid argument is provided.HomomorphicException- if a homomorphic encryption error occurs.ClassNotFoundException- if the class of a serialized object cannot be found.
-
Protocol2
boolean Protocol2(BigInteger x, BigInteger y) throws IOException, ClassNotFoundException, HomomorphicException Compares two encrypted integers and determines if the first is greater than or equal to the second.- Parameters:
x- the first encrypted integer.y- the second encrypted integer.- Returns:
- true if x is greater than or equal to y, false otherwise.
- Throws:
IOException- if an I/O error occurs.ClassNotFoundException- if the class of a serialized object cannot be found.HomomorphicException- if a homomorphic encryption error occurs.
-
division
BigInteger division(BigInteger x, long d) throws IOException, ClassNotFoundException, HomomorphicException Performs division on an encrypted integer.- Parameters:
x- the encrypted integer to divide.d- the divisor.- Returns:
- the result of the division as an encrypted integer.
- Throws:
IOException- if an I/O error occurs.ClassNotFoundException- if the class of a serialized object cannot be found.HomomorphicException- if a homomorphic encryption error occurs.
-
multiplication
BigInteger multiplication(BigInteger x, BigInteger y) throws IOException, ClassNotFoundException, IllegalArgumentException, HomomorphicException Performs multiplication on two encrypted integers.- Parameters:
x- the first encrypted integer.y- the second encrypted integer.- Returns:
- the result of the multiplication as an encrypted integer.
- Throws:
IOException- if an I/O error occurs.ClassNotFoundException- if the class of a serialized object cannot be found.IllegalArgumentException- if an invalid argument is provided.HomomorphicException- if a homomorphic encryption error occurs.
-
receivePublicKeys
Receives public keys from the other party.- Throws:
IOException- if an I/O error occurs.ClassNotFoundException- if the class of a serialized object cannot be found.
-
getKValues
BigInteger[] getKValues(BigInteger[] input, int k, boolean biggest_first) throws ClassNotFoundException, IOException, IllegalArgumentException, HomomorphicException Retrieves the k largest or smallest values from an array of encrypted integers.- Parameters:
input- the array of encrypted integers.k- the number of values to retrieve.biggest_first- true to retrieve the largest values, false to retrieve the smallest values.- Returns:
- an array of the k largest or smallest encrypted integers.
- Throws:
ClassNotFoundException- if the class of a serialized object cannot be found.IOException- if an I/O error occurs.IllegalArgumentException- if an invalid argument is provided.HomomorphicException- if a homomorphic encryption error occurs.
-
getKValues
BigInteger[] getKValues(List<BigInteger> input, int k, boolean smallest_first) throws ClassNotFoundException, IOException, IllegalArgumentException, HomomorphicException Retrieves the k largest or smallest values from a list of encrypted integers.- Parameters:
input- the list of encrypted integers.k- the number of values to retrieve.smallest_first- true to retrieve the smallest values, false to retrieve the largest values.- Returns:
- an array of the k largest or smallest encrypted integers.
- Throws:
ClassNotFoundException- if the class of a serialized object cannot be found.IOException- if an I/O error occurs.IllegalArgumentException- if an invalid argument is provided.HomomorphicException- if a homomorphic encryption error occurs.
-
set_socket
Sets the socket for communication.- Parameters:
socket- the socket to use for communication.- Throws:
IOException- if an I/O error occurs.
-