Class PaillierSignature
java.lang.Object
edu.fiu.adwise.homomorphic_encryption.paillier.PaillierSignature
This class provides methods for signing and verifying messages using the Paillier cryptosystem.
The Paillier cryptosystem is a probabilistic asymmetric algorithm for public key cryptography.
It supports homomorphic encryption and is based on composite degree residuosity classes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<BigInteger>sign(BigInteger message, PaillierPrivateKey private_key) Signs a message using the provided Paillier private key.static booleanverify(BigInteger message, BigInteger sigma_one, BigInteger sigma_two, PaillierPublicKey public_key) Verifies a Paillier signature using its individual components.static booleanverify(BigInteger message, List<BigInteger> signed_message, PaillierPublicKey public_key) Verifies a signed message using the provided Paillier public key.
-
Constructor Details
-
PaillierSignature
public PaillierSignature()
-
-
Method Details
-
sign
Signs a message using the provided Paillier private key. The signature consists of two components: sigma\_one and sigma\_two. Please refer to "Public-Key Cryptosystems Based on Composite Degree Residuosity Classes"- Parameters:
message- The message to be signed, represented as aBigInteger.private_key- ThePaillierPrivateKeyused to sign the message.- Returns:
- A
ListofBigIntegercontaining the two components of the signature. The first element is sigma\_one, and the second element is sigma\_two.
-
verify
public static boolean verify(BigInteger message, List<BigInteger> signed_message, PaillierPublicKey public_key) Verifies a signed message using the provided Paillier public key. This method checks the validity of the signature by comparing the computed values with the original message.- Parameters:
message- The original plaintext message, represented as aBigInteger.signed_message- AListofBigIntegercontaining the signature components. The first element is sigma\_one, and the second element is sigma\_two.public_key- ThePaillierPublicKeyused to verify the signature.- Returns:
trueif the signature is valid,falseotherwise.- Throws:
AssertionError- If the signed\_message does not contain exactly two components.
-
verify
public static boolean verify(BigInteger message, BigInteger sigma_one, BigInteger sigma_two, PaillierPublicKey public_key) Verifies a Paillier signature using its individual components. This method computes the expected values of the signature components and compares them with the provided message.- Parameters:
message- The original plaintext message, represented as aBigInteger.sigma_one- The first component of the signature.sigma_two- The second component of the signature.public_key- ThePaillierPublicKeyused to verify the signature.- Returns:
trueif the signature is valid,falseotherwise.
-