Class DGKPublicKey
java.lang.Object
edu.fiu.adwise.homomorphic_encryption.dgk.DGKPublicKey
- All Implemented Interfaces:
DGK_Key,CipherConstants,Serializable,Runnable,Key,PublicKey
public final class DGKPublicKey
extends Object
implements Serializable, DGK_Key, PublicKey, Runnable, CipherConstants
Represents the public key for the DGK (Damgård-Geisler-Krøigaard) cryptosystem.
This class implements the Serializable, DGK_Key, PublicKey, Runnable, and CipherConstants interfaces.
It provides methods for key generation, serialization, and lookup table generation for encryption operations.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe encrypted representation of the value 1.The encrypted representation of the value 0. -
Constructor Summary
ConstructorsConstructorDescriptionDGKPublicKey(BigInteger n, BigInteger g, BigInteger h, BigInteger u, int l, int t, int k) Constructs a DGKPublicKey with all required parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this DGKPublicKey with another object for equality.byte[]intgetL()Retrieves the bit length \( l \) of the DGK key.getN()Retrieves the modulus \( n \) associated with the DGK key.intgetT()longgetu()getU()Retrieves the value of \( u \), a parameter associated with the DGK key.static DGKPublicKeyDeserializes a DGKPublicKey from a file.voidrun()Generates the lookup tables for g and h.toString()voidSerializes the public key to a file.ZERO()
-
Field Details
-
ONE
The encrypted representation of the value 1. -
ZERO
The encrypted representation of the value 0.
-
-
Constructor Details
-
DGKPublicKey
Constructs a DGKPublicKey with all required parameters.- Parameters:
n- The modulus.g- The generator.h- The secondary generator.u- The order of the subgroup.l- The bit length of plaintext.t- The security parameter.k- The key size.
-
-
Method Details
-
writeKey
Serializes the public key to a file.- Parameters:
dgk_public_key_file- The file path to save the public key.- Throws:
IOException- If an I/O error occurs.
-
readKey
public static DGKPublicKey readKey(String dgk_public_key) throws IOException, ClassNotFoundException Deserializes a DGKPublicKey from a file.- Parameters:
dgk_public_key- The file path to read the public key from.- Returns:
- The deserialized DGKPublicKey.
- Throws:
IOException- If an I/O error occurs.ClassNotFoundException- If the class cannot be found.
-
ZERO
- Returns:
- The encrypted representation of 0.
- Throws:
HomomorphicException- - If an invalid input was found, this should be impossible in this case
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceKey- Returns:
- The algorithm name ("DGK").
-
toString
-
getFormat
-
getEncoded
public byte[] getEncoded()- Specified by:
getEncodedin interfaceKey- Returns:
- The encoded form of the key (currently null).
-
run
public void run()Generates the lookup tables for g and h. -
getu
public long getu()- Returns:
- The order of the subgroup as a long.
-
getU
Description copied from interface:DGK_KeyRetrieves the value of \( u \), a parameter associated with the DGK key. -
getN
Description copied from interface:DGK_KeyRetrieves the modulus \( n \) associated with the DGK key. -
getL
public int getL()Description copied from interface:DGK_KeyRetrieves the bit length \( l \) of the DGK key. -
getT
public int getT()- Returns:
- The security parameter.
-
equals
Compares this DGKPublicKey with another object for equality.
-