Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix V3.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cryptix.provider.elgamal
Class ElGamalAlgorithm

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

public final class ElGamalAlgorithm
extends java.lang.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 $

Since:
  Cryptix 2.2.2
Author:
  David Hopwood

Method Summary
`static java.math.BigInteger` | `decrypt(java.math.BigInteger a, java.math.BigInteger b, java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger x)` The decryption algorithm for ElGamal.
`static void` | `encrypt(java.math.BigInteger M, java.math.BigInteger[] ab, java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger y, java.util.Random rng)` The encryption algorithm for ElGamal.
`static void` | `sign(java.math.BigInteger M, java.math.BigInteger[] ab, java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger x, java.util.Random rng)` The signature algorithm for ElGamal.
`static boolean` | `verify(java.math.BigInteger M, java.math.BigInteger a, java.math.BigInteger b, java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger y)` The verification algorithm for ElGamal.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### encrypt

    public static void encrypt(java.math.BigInteger M,
                               java.math.BigInteger[] ab,
                               java.math.BigInteger p,
                               java.math.BigInteger g,
                               java.math.BigInteger y,
                               java.util.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.

### decrypt

    public static java.math.BigInteger decrypt(java.math.BigInteger a,
                                               java.math.BigInteger b,
                                               java.math.BigInteger p,
                                               java.math.BigInteger g,
                                               java.math.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.

### sign

    public static void sign(java.math.BigInteger M,
                            java.math.BigInteger[] ab,
                            java.math.BigInteger p,
                            java.math.BigInteger g,
                            java.math.BigInteger x,
                            java.util.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.

### verify

    public static boolean verify(java.math.BigInteger M,
                                 java.math.BigInteger a,
                                 java.math.BigInteger b,
                                 java.math.BigInteger p,
                                 java.math.BigInteger g,
                                 java.math.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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix V3.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) 1995-2000 The Cryptix Foundation Ltd. All rights reserved.