Class ElGamalSignature
java.lang.Object
edu.fiu.adwise.homomorphic_encryption.elgamal.ElGamalSignature
- All Implemented Interfaces:
CipherConstants
This class provides methods for signing and verifying messages using the ElGamal signature scheme.
The ElGamal signature scheme is a cryptographic algorithm used for digital signatures. For more details, see ElGamal Signature Scheme.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ElGamal_Ciphertextsign(BigInteger message, ElGamalPrivateKey private_key) Signs a message using the ElGamal private key.static booleanverify(BigInteger message, ElGamal_Ciphertext signature, ElGamalPublicKey public_key) Verifies a signed message using the ElGamal public key.
-
Constructor Details
-
ElGamalSignature
public ElGamalSignature()
-
-
Method Details
-
sign
Signs a message using the ElGamal private key.This method generates a digital signature for the given message using the private key.
- Parameters:
message- The plaintext message to be signed.private_key- The ElGamal private key used for signing.- Returns:
- An
ElGamal_Ciphertextobject containing the signature (r, s).
-
verify
public static boolean verify(BigInteger message, ElGamal_Ciphertext signature, ElGamalPublicKey public_key) Verifies a signed message using the ElGamal public key.This method checks the integrity and authenticity of the signed message.
- Parameters:
message- The plaintext message to verify.signature- The signed message to verify, represented as anElGamal_Ciphertext.public_key- The ElGamal public key used for verification.- Returns:
trueif the signature is valid,falseotherwise.
-