Class PaillierKeyPairGenerator
java.lang.Object
java.security.KeyPairGeneratorSpi
edu.fiu.adwise.homomorphic_encryption.paillier.PaillierKeyPairGenerator
- All Implemented Interfaces:
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.-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGenerates a Paillier key pair (public and private keys).voidinitialize(int key_size, SecureRandom random) Initializes the Paillier key pair generator with the specified key size and random number generator.static voidMain method to generate and save Paillier public and private keys to files.Methods inherited from class java.security.KeyPairGeneratorSpi
initialize
-
Constructor Details
-
PaillierKeyPairGenerator
public PaillierKeyPairGenerator()
-
-
Method Details
-
main
Main method to generate and save Paillier public and private keys to files.- Parameters:
args- Command-line arguments (not used).
-
initialize
Initializes the Paillier key pair generator with the specified key size and random number generator.- Specified by:
initializein classKeyPairGeneratorSpi- Parameters:
key_size- The size of the key in bits. Must be an even number and at leastKEY_SIZE.random- TheSecureRandominstance to use for key generation. Can benull.- Throws:
IllegalArgumentException- If the key size is not even or is less thanKEY_SIZE.
-
generateKeyPair
Generates a Paillier key pair (public and private keys).- Specified by:
generateKeyPairin classKeyPairGeneratorSpi- Returns:
- A
KeyPaircontaining the Paillier public and private keys.
-