part3
Class EGPublicKey

java.lang.Object
  extended bypart3.EGPublicKey
Direct Known Subclasses:
EGVerificationKey

public class EGPublicKey
extends java.lang.Object

A class to implement an ElGamal public key.


Field Summary
protected  java.math.BigInteger _g
           
protected  java.math.BigInteger _p
           
protected  java.math.BigInteger _y
           
 
Constructor Summary
EGPublicKey(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger y)
          A constructor for an ElGamal public key (p,g,y).
EGPublicKey(EGPublicKey key)
          A copy constructor for an ElGamal public key.
 
Method Summary
 EGCipherText encrypt(java.math.BigInteger m, java.security.SecureRandom rnd)
          A method to encrypt the big integer m using this public key.
 java.util.AbstractList encrypt(java.lang.String s, java.security.SecureRandom rnd)
          A method to encrypt the string s using this public key.
 java.lang.String toString()
          A method to produce a string representation of this public EG key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_p

protected java.math.BigInteger _p

_g

protected java.math.BigInteger _g

_y

protected java.math.BigInteger _y
Constructor Detail

EGPublicKey

public EGPublicKey(java.math.BigInteger p,
                   java.math.BigInteger g,
                   java.math.BigInteger y)
            throws java.lang.Exception
A constructor for an ElGamal public key (p,g,y).

Throws:
Exception.
java.lang.Exception

EGPublicKey

public EGPublicKey(EGPublicKey key)
            throws java.lang.Exception
A copy constructor for an ElGamal public key.

Throws:
Exception.
java.lang.Exception
Method Detail

encrypt

public EGCipherText encrypt(java.math.BigInteger m,
                            java.security.SecureRandom rnd)
                     throws java.lang.Exception
A method to encrypt the big integer m using this public key.

Throws:
Exception.
java.lang.Exception

encrypt

public java.util.AbstractList encrypt(java.lang.String s,
                                      java.security.SecureRandom rnd)
                               throws java.lang.Exception
A method to encrypt the string s using this public key.

Returns:
A list of EGCipherText objects.
Throws:
Exception.
java.lang.Exception

toString

public java.lang.String toString()
A method to produce a string representation of this public EG key.

Throws:
Exception.