Class ElGamalPublicKey

java.lang.Object
edu.fiu.adwise.homomorphic_encryption.elgamal.ElGamalPublicKey
All Implemented Interfaces:
ElGamal_Key, Serializable, Key, PublicKey

public final class ElGamalPublicKey extends Object implements Serializable, PublicKey, ElGamal_Key
Represents the public key for the ElGamal encryption scheme.
See Also:
  • Field Details

    • additive

      public boolean additive
      Indicates whether additive homomorphic encryption is enabled.
  • Constructor Details

    • ElGamalPublicKey

      public ElGamalPublicKey(BigInteger p, BigInteger g, BigInteger h, boolean additive)
      Constructs an ElGamalPublicKey with the specified parameters.
      Parameters:
      p - The prime modulus.
      g - The generator.
      h - The public key component.
      additive - Whether the key is used for additive homomorphism.
  • Method Details

    • set_additive

      public void set_additive(boolean additive)
      Sets whether the key is used for additive homomorphism.
      Specified by:
      set_additive in interface ElGamal_Key
      Parameters:
      additive - True if the key is additive, false otherwise.
    • getAlgorithm

      public String getAlgorithm()
      Returns the algorithm name.
      Specified by:
      getAlgorithm in interface Key
      Returns:
      The algorithm name ("ElGamal").
    • getFormat

      public String getFormat()
      Returns the format of the key.
      Specified by:
      getFormat in interface Key
      Returns:
      The format of the key ("X.509").
    • getEncoded

      public byte[] getEncoded()
      Returns the encoded form of the key.
      Specified by:
      getEncoded in interface Key
      Returns:
      The encoded form of the key (currently null).
    • getP

      public BigInteger getP()
      Returns the prime modulus.
      Specified by:
      getP in interface ElGamal_Key
      Returns:
      The prime modulus.
    • toString

      public String toString()
      Returns a string representation of the ElGamal public key.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the key.