Class PaillierKeyPairGenerator

java.lang.Object
java.security.KeyPairGeneratorSpi
edu.fiu.adwise.homomorphic_encryption.paillier.PaillierKeyPairGenerator
All Implemented Interfaces:
CipherConstants

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

    • PaillierKeyPairGenerator

      public PaillierKeyPairGenerator()
  • Method Details

    • main

      public static void main(String[] args)
      Main method to generate and save Paillier public and private keys to files.
      Parameters:
      args - Command-line arguments (not used).
    • initialize

      public void initialize(int key_size, SecureRandom random)
      Initializes the Paillier key pair generator with the specified key size and random number generator.
      Specified by:
      initialize in class KeyPairGeneratorSpi
      Parameters:
      key_size - The size of the key in bits. Must be an even number and at least KEY_SIZE.
      random - The SecureRandom instance to use for key generation. Can be null.
      Throws:
      IllegalArgumentException - If the key size is not even or is less than KEY_SIZE.
    • generateKeyPair

      public KeyPair generateKeyPair()
      Generates a Paillier key pair (public and private keys).
      Specified by:
      generateKeyPair in class KeyPairGeneratorSpi
      Returns:
      A KeyPair containing the Paillier public and private keys.