Class socialist_millionaires
java.lang.Object
edu.fiu.adwise.homomorphic_encryption.socialistmillionaire.socialist_millionaires
- All Implemented Interfaces:
CipherConstants
Abstract class representing the Socialist Millionaires' Problem (SMP) protocol.
This class provides the base implementation for secure multi-party computation
using homomorphic encryption techniques.
It includes methods for managing cryptographic keys, performing I/O operations, and utility functions for encrypted data manipulation.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongRetrieves the total number of bytes sent during communication.Retrieves the DGK public key.Retrieves the ElGamal public key.Retrieves the Paillier public key.booleanisDGK()Checks if DGK encryption mode is enabled.booleanReads a boolean value from the input stream.intreadInt()Reads an integer value from the input stream.Reads an object from the input stream.voidsetDGKMode(boolean isDGK) Sets the DGK encryption mode.voidsetDGKPublicKey(DGKPublicKey dgk_public) Sets the DGK public key and precomputes 2^l.voidsetElGamalPublicKey(ElGamalPublicKey el_gamal_public) Sets the ElGamal public key.voidsetPaillierPublicKey(PaillierPublicKey paillier_public) Sets the Paillier public key.voidwriteBoolean(boolean value) Writes a boolean value to the output stream.voidwriteInt(int value) Writes an integer value to the output stream.voidWrites an object to the output stream.
-
Constructor Details
-
socialist_millionaires
public socialist_millionaires()
-
-
Method Details
-
setDGKMode
public void setDGKMode(boolean isDGK) Sets the DGK encryption mode.- Parameters:
isDGK- true to enable DGK mode, false otherwise.
-
isDGK
public boolean isDGK()Checks if DGK encryption mode is enabled.- Returns:
- true if DGK mode is enabled, false otherwise.
-
setPaillierPublicKey
Sets the Paillier public key.- Parameters:
paillier_public- the Paillier public key.
-
setDGKPublicKey
Sets the DGK public key and precomputes 2^l.- Parameters:
dgk_public- the DGK public key.
-
setElGamalPublicKey
Sets the ElGamal public key.- Parameters:
el_gamal_public- the ElGamal public key.
-
getPaillierPublicKey
Retrieves the Paillier public key.- Returns:
- the Paillier public key.
-
getDGKPublicKey
Retrieves the DGK public key.- Returns:
- the DGK public key.
-
getElGamalPublicKey
Retrieves the ElGamal public key.- Returns:
- the ElGamal public key.
-
get_bytes_sent
public long get_bytes_sent()Retrieves the total number of bytes sent during communication.- Returns:
- the total bytes sent.
-
readBoolean
Reads a boolean value from the input stream.- Returns:
- the boolean value read.
- Throws:
IOException- if an I/O error occurs.
-
writeBoolean
Writes a boolean value to the output stream.- Parameters:
value- the boolean value to write.- Throws:
IOException- if an I/O error occurs.
-
readInt
Reads an integer value from the input stream.- Returns:
- the integer value read.
- Throws:
IOException- if an I/O error occurs.
-
writeInt
Writes an integer value to the output stream.- Parameters:
value- the integer value to write.- Throws:
IOException- if an I/O error occurs.
-
readObject
Reads an object from the input stream.- Returns:
- the object read.
- Throws:
IOException- if an I/O error occurs.ClassNotFoundException- if the class of the object cannot be found.
-
writeObject
Writes an object to the output stream.- Parameters:
o- the object to write.- Throws:
IOException- if an I/O error occurs.
-