Class GMCipher
java.lang.Object
edu.fiu.adwise.homomorphic_encryption.gm.GMCipher
- All Implemented Interfaces:
CipherConstants
This class implements the Goldwasser-Micali (GM) encryption scheme.
It provides methods for encrypting, decrypting, and performing XOR operations
on encrypted bits using the GM cryptosystem.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BigIntegerdecrypt(BigInteger[] cipher, GMPrivateKey private_key) Decrypts an array of Goldwasser-Micali encrypted bits.static BigInteger[]encrypt(BigInteger message, GMPublicKey public_key) Encrypts a BigInteger plaintext using the Goldwasser-Micali encryption scheme.static BigInteger[]xor(BigInteger[] cipher_1, BigInteger[] cipher_2, GMPublicKey public_key) Performs a bitwise XOR operation on two arrays of Goldwasser-Micali encrypted bits.
-
Constructor Details
-
GMCipher
public GMCipher()
-
-
Method Details
-
encrypt
Encrypts a BigInteger plaintext using the Goldwasser-Micali encryption scheme.- Parameters:
message- The plaintext message to be encrypted.public_key- The public key used for encryption.- Returns:
- An array of BigInteger representing the encrypted bits.
-
decrypt
Decrypts an array of Goldwasser-Micali encrypted bits.- Parameters:
cipher- The array of encrypted bits to be decrypted.private_key- The private key used for decryption.- Returns:
- The decrypted plaintext as a BigInteger.
-
xor
public static BigInteger[] xor(BigInteger[] cipher_1, BigInteger[] cipher_2, GMPublicKey public_key) throws HomomorphicException Performs a bitwise XOR operation on two arrays of Goldwasser-Micali encrypted bits.- Parameters:
cipher_1- The first array of encrypted bits.cipher_2- The second array of encrypted bits.public_key- The public key used for encryption.- Returns:
- An array of BigInteger representing the XORed encrypted bits.
- Throws:
HomomorphicException- If the lengths of the two ciphertext arrays are not equal.
-