Class DGKKeyPairGenerator

java.lang.Object
java.security.KeyPairGeneratorSpi
edu.fiu.adwise.homomorphic_encryption.dgk.DGKKeyPairGenerator
All Implemented Interfaces:
CipherConstants

public final class DGKKeyPairGenerator extends KeyPairGeneratorSpi implements CipherConstants
This class is responsible for generating DGK key pairs (public and private keys) used in the DGK cryptosystem. It extends the KeyPairGeneratorSpi class and implements the CipherConstants interface.
  • Constructor Details

    • DGKKeyPairGenerator

      public DGKKeyPairGenerator()
      Default constructor for DGKKeyPairGenerator. Initializes the generator with default parameters.
    • DGKKeyPairGenerator

      public DGKKeyPairGenerator(int l, int t, int k) throws HomomorphicException
      Initialize DGK Key pair generator and sets DGK parameters
      Parameters:
      l - - sets size of plaintext
      t - - security parameter
      k - - number of bits of keys
      Throws:
      HomomorphicException - If invalid parameters are provided
  • Method Details

    • main

      public static void main(String[] args) throws IOException
      Main method to generate and save DGK key pairs.
      Parameters:
      args - Command-line arguments
      Throws:
      IOException - If an error occurs while writing keys to files
    • getL

      public int getL()
      Gets the size of plaintext.
      Returns:
      The size of plaintext
    • setL

      public void setL(int l) throws HomomorphicException
      Sets the size of plaintext.
      Parameters:
      l - The size of plaintext
      Throws:
      HomomorphicException - If invalid parameters are provided
    • getT

      public int getT()
      Gets the security parameter.
      Returns:
      The security parameter
    • setT

      public void setT(int t) throws HomomorphicException
      Sets the security parameter.
      Parameters:
      t - The security parameter
      Throws:
      HomomorphicException - If invalid parameters are provided
    • getK

      public int getK()
      Gets the key size in bits.
      Returns:
      The key size in bits
    • setK

      public void setK(int k) throws HomomorphicException
      Sets the key size in bits.
      Parameters:
      k - The key size in bits
      Throws:
      HomomorphicException - If invalid parameters are provided
    • initialize

      public void initialize(int k, SecureRandom random)
      Initializes the DGK key pair generator with the specified key size and random generator.
      Specified by:
      initialize in class KeyPairGeneratorSpi
      Parameters:
      k - The key size in bits
      random - The random generator
    • generateKeyPair

      public KeyPair generateKeyPair()
      Generates a DGK key pair.
      Specified by:
      generateKeyPair in class KeyPairGeneratorSpi
      Returns:
      The generated DGK key pair
    • toString

      public String toString()
      Returns a string representation of the DGKKeyPairGenerator.
      Overrides:
      toString in class Object
      Returns:
      A string containing the parameters l, t, and k