Class bob
java.lang.Object
edu.fiu.adwise.homomorphic_encryption.socialistmillionaire.socialist_millionaires
edu.fiu.adwise.homomorphic_encryption.socialistmillionaire.bob
- All Implemented Interfaces:
CipherConstants,bob_interface
- Direct Known Subclasses:
bob_joye,bob_veugen
The
bob class represents Bob in the Socialist Millionaire's Problem.
It implements the bob_interface and extends socialist_millionaires.
This class provides methods for secure equality testing and other cryptographic operations
using homomorphic encryption techniques.
This specific class implements the first generation of encrypted comparison protocols
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintComputes the delta value (deltaB) for Bob based on the decrypted values in C.voiddivision(long divisor) Please review Protocol 2 in the "Encrypted Integer Division" paper by Thjis Veugen Performs secure division of an encrypted value received from Alice by a given divisor.Encrypts the bits of a given plaintext value.void.voidSee the paper "Correction of a Secure Comparison Protocol for Encrypted Integers in IEEE WIFS 2012 (Short Paper)" This performs secure multiplication of two encrypted values.booleanPlease review "Improving the DGK comparison protocol" - Protocol 1 Nicely enough; this is the same thing Bob needs to do for Veugen, Joye and checking if two encrypted numbers are equal! This is the original protocol from DGK, the improved versions are in alice_veugen.booleanPlease review "Improving the DGK comparison protocol" - Protocol 2 Executes Protocol 2 for secure comparison.voidSends Bob's public keys (DGK, Paillier, and ElGamal) to Alice.voidset_socket(Socket socket) Sets the socket for communication with Alice.voidsort()Sorts a list of encrypted numbers using Protocol 2.Methods 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
-
bob
Constructs a Bob instance with three key pairs.- Parameters:
first- the first key pair (Paillier or DGK).second- the second key pair (DGK or Paillier).third- the third key pair (ElGamal), optional.
-
bob
Constructs a Bob instance with two key pairs.- Parameters:
first- the first key pair (Paillier or DGK).second- the second key pair (DGK or Paillier).
-
-
Method Details
-
set_socket
Sets the socket for communication with Alice.- Specified by:
set_socketin interfacebob_interface- Parameters:
socket- the socket to use for communication.- Throws:
IOException- if an I/O error occurs.NullPointerException- if the provided socket is null.
-
sort
Sorts a list of encrypted numbers using Protocol 2. This method repeatedly invokes Protocol 2 until the sorting is complete.- Specified by:
sortin interfacebob_interface- Throws:
IOException- if an I/O error occurs.ClassNotFoundException- if a class cannot be found during deserialization.HomomorphicException- if an error occurs during homomorphic operations.
-
encrypted_equals
. Review "Protocol 1 EQT-1" from the paper "Secure Equality Testing Protocols in the Two-Party Setting"- Specified by:
encrypted_equalsin interfacebob_interface- Throws:
IOException- if an I/O error occurs.HomomorphicException- if an error occurs during homomorphic operations.ClassNotFoundException- if a class cannot be found during deserialization.
-
encrypt_bits
Encrypts the bits of a given plaintext value.- Parameters:
y- the plaintext value to encrypt.- Returns:
- an array of encrypted bits.
- Throws:
HomomorphicException- if an error occurs during homomorphic operations.
-
compute_delta_b
Computes the delta value (deltaB) for Bob based on the decrypted values in C.- Parameters:
C- the array of encrypted values.- Returns:
- the computed delta value (deltaB).
- Throws:
HomomorphicException- if an error occurs during homomorphic operations.
-
Protocol1
public boolean Protocol1(BigInteger y) throws IOException, ClassNotFoundException, IllegalArgumentException, HomomorphicException Please review "Improving the DGK comparison protocol" - Protocol 1 Nicely enough; this is the same thing Bob needs to do for Veugen, Joye and checking if two encrypted numbers are equal! This is the original protocol from DGK, the improved versions are in alice_veugen. This protocol allows Bob to securely compare encrypted values with Alice and determine equality without revealing the plaintext values.- Specified by:
Protocol1in interfacebob_interface- Parameters:
y- the plaintext value to compare.- Returns:
trueif the comparison result indicates equality,falseotherwise.- Throws:
IOException- if an I/O error occurs during communication.ClassNotFoundException- if a class cannot be found during deserialization.IllegalArgumentException- ifyhas more bits than supported by the DGK keys.HomomorphicException- if an error occurs during homomorphic operations.
-
Protocol2
Please review "Improving the DGK comparison protocol" - Protocol 2 Executes Protocol 2 for secure comparison. This protocol allows Bob to securely compare encrypted values with Alice. This uses the original comparison protocol from DGK, the improved versions are in alice_veugen and alice_joye.- Specified by:
Protocol2in interfacebob_interface- Returns:
trueif the comparison result indicatesx >= 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 homomorphic operations.
-
multiplication
See the paper "Correction of a Secure Comparison Protocol for Encrypted Integers in IEEE WIFS 2012 (Short Paper)" This performs secure multiplication of two encrypted values. This method decrypts the values, performs multiplication, and re-encrypts the result, but the results are blinded by Alice, so Bob should not be aware what the actual product is.- Specified by:
multiplicationin interfacebob_interface- 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 homomorphic operations.
-
division
Please review Protocol 2 in the "Encrypted Integer Division" paper by Thjis Veugen Performs secure division of an encrypted value received from Alice by a given divisor. The result is encrypted and sent back to Alice. Bob does not learn the plaintext result.- Specified by:
divisionin interfacebob_interface- Parameters:
divisor- the divisor to divide the encrypted value by.- Throws:
ClassNotFoundException- if a class cannot be found during deserialization.IOException- if an I/O error occurs during communication.HomomorphicException- if an error occurs during homomorphic operations.IllegalArgumentException- if the received object is not aBigInteger.
-
sendPublicKeys
Sends Bob's public keys (DGK, Paillier, and ElGamal) to Alice. If a key is not available, a placeholder value ofBigInteger.ZEROis sent instead.- Specified by:
sendPublicKeysin interfacebob_interface- Throws:
IOException- if an I/O error occurs during communication.
-