All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptix.provider.elgamal.ElGamalAlgorithm

java.lang.Object
   |
   +----cryptix.provider.elgamal.ElGamalAlgorithm

public final class ElGamalAlgorithm
extends Object
A class that calculates the ElGamal family of algorithms (encryption, decryption, signing and verification).

References:

  1. Bruce Schneier, "Section 19.6 ElGamal," Applied Cryptography, 2nd edition, John Wiley & Sons, 1996.

Copyright © 1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.2 $

Author:
David Hopwood

Method Index

 o decrypt(BigInteger, BigInteger, BigInteger, BigInteger, BigInteger)
The decryption algorithm for ElGamal.
 o encrypt(BigInteger, BigInteger[], BigInteger, BigInteger, BigInteger, Random)
The encryption algorithm for ElGamal.
 o sign(BigInteger, BigInteger[], BigInteger, BigInteger, BigInteger, Random)
The signature algorithm for ElGamal.
 o verify(BigInteger, BigInteger, BigInteger, BigInteger, BigInteger, BigInteger)
The verification algorithm for ElGamal.

Methods

 o encrypt
 public static void encrypt(BigInteger M,
                            BigInteger ab[],
                            BigInteger p,
                            BigInteger g,
                            BigInteger y,
                            Random rng)
The encryption algorithm for ElGamal. The two parts of the ciphertext, a and b, will be stored in ab[0] and ab[1] respectively.

Parameters:
M - the plaintext.
ab - a 2-element BigInteger array in which to store the ciphertext.
p - the prime from the public key.
g - the generator from the public key.
y - the value of y from the public key.
rng - a random number generator to be used for encryption.
 o decrypt
 public static BigInteger decrypt(BigInteger a,
                                  BigInteger b,
                                  BigInteger p,
                                  BigInteger g,
                                  BigInteger x)
The decryption algorithm for ElGamal. a and b are the two parts of the ciphertext (using the same convention as given in Schneier).

Parameters:
a - the first part of the ciphertext.
b - the second part of the ciphertext.
p - the prime from the private key.
g - the generator from the private key.
x - the value of x from the private key.
Returns:
the plaintext.
 o sign
 public static void sign(BigInteger M,
                         BigInteger ab[],
                         BigInteger p,
                         BigInteger g,
                         BigInteger x,
                         Random rng)
The signature algorithm for ElGamal. ab should be a two-element BigInteger array. The two parts of the signature, a and b, will be stored in ab[0] and ab[1] respectively.

Parameters:
M - the value to be signed.
ab - an array in which to store the result.
p - the prime from the private key.
g - the generator from the private key.
x - the value of x from the private key.
rng - a random number generator to be used for signing.
Returns:
true iff the signature is valid.
 o verify
 public static boolean verify(BigInteger M,
                              BigInteger a,
                              BigInteger b,
                              BigInteger p,
                              BigInteger g,
                              BigInteger y)
The verification algorithm for ElGamal. Returns true iff the signature was verified successfully.

Parameters:
M - the value that was signed.
a - the first part of the signature.
b - the second part of the signature.
p - the prime from the public key.
g - the generator from the public key.
y - the value of y from the public key.
Returns:
true iff the signature is valid.

All Packages  Class Hierarchy  This Package  Previous  Next  Index