Class ElGamalPrivateKey
java.lang.Object
edu.fiu.adwise.homomorphic_encryption.elgamal.ElGamalPrivateKey
- All Implemented Interfaces:
ElGamal_Key,CipherConstants,Serializable,Runnable,Key,PrivateKey,Destroyable
public final class ElGamalPrivateKey
extends Object
implements ElGamal_Key, Serializable, PrivateKey, Runnable, CipherConstants
Represents the private key for the ElGamal encryption scheme.
This class implements multiple interfaces to provide functionality for cryptographic operations,
serialization, and multithreading.
The ElGamalPrivateKey class includes parameters for the private key, as well as the public key components (p, g, h). It also supports additive homomorphic encryption by generating a lookup table for decryption.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionElGamalPrivateKey(BigInteger p, BigInteger x, BigInteger g, BigInteger h, boolean additive) Constructs an ElGamalPrivateKey with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns the algorithm name.byte[]Returns the encoded form of the key.Returns the format of the key.getP()Returns the prime modulus p.voidrun()Runs the decryption table generation in a separate thread.voidset_additive(boolean additive) Sets whether additive homomorphic encryption is enabled.toString()Returns a string representation of the private key.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javax.security.auth.Destroyable
destroy, isDestroyed
-
Constructor Details
-
ElGamalPrivateKey
Constructs an ElGamalPrivateKey with the specified parameters.- Parameters:
p- The prime modulus.x- The private key parameter.g- The generator.h- The public key component.additive- Whether additive homomorphic encryption is enabled.
-
-
Method Details
-
set_additive
public void set_additive(boolean additive) Sets whether additive homomorphic encryption is enabled.- Specified by:
set_additivein interfaceElGamal_Key- Parameters:
additive- True to enable additive homomorphic encryption, false otherwise.
-
getAlgorithm
Returns the algorithm name.- Specified by:
getAlgorithmin interfaceKey- Returns:
- The algorithm name, "ElGamal".
-
getFormat
Returns the format of the key. -
getEncoded
public byte[] getEncoded()Returns the encoded form of the key.- Specified by:
getEncodedin interfaceKey- Returns:
- The encoded key, or null if not supported.
-
run
public void run()Runs the decryption table generation in a separate thread. -
toString
Returns a string representation of the private key. -
getP
Returns the prime modulus p.- Specified by:
getPin interfaceElGamal_Key- Returns:
- The prime modulus p.
-