cryptix.provider.elgamal
Class BaseElGamalPublicKey

java.lang.Object
  |
  +--cryptix.provider.elgamal.BaseElGamalPublicKey
All Implemented Interfaces:
ElGamalKey, ElGamalPublicKey, java.security.Key, java.security.PublicKey, java.io.Serializable
Direct Known Subclasses:
BaseElGamalPrivateKey

public class BaseElGamalPublicKey
extends java.lang.Object
implements ElGamalPublicKey

A class representing an ElGamal public key. This is also a superclass for ElGamal private keys. It is called BaseElGamalPublicKey to distinguish it from the interface ElGamalPublicKey, without having to use fully-qualified names.

References:

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

  2. IEEE P1363 draft standard, http://stdsbbs.ieee.org/groups/1363/index.html

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
See Also:
ElGamalParams, Key, java.security.Cipher, Signature, Serialized Form

Field Summary
protected  java.math.BigInteger g
           
protected  java.math.BigInteger p
           
protected  java.math.BigInteger y
           
 
Fields inherited from interface java.security.PublicKey
serialVersionUID
 
Constructor Summary
BaseElGamalPublicKey(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger y)
          Constructs a BaseElGamalPublicKey with the specified prime p, base g, and public value y = gx mod p.
BaseElGamalPublicKey(ElGamalParams params, java.math.BigInteger y)
          Constructs a BaseElGamalPublicKey with a prime and base taken from an object implementing java.security.interfaces.ElGamalParams, and the specified public value y = gx mod p.
 
Method Summary
 java.lang.String getAlgorithm()
          Returns the name of the algorithm this key is intended for ("ElGamal").
 byte[] getEncoded()
          Returns an encoding of this key as a byte array.
 java.lang.String getFormat()
          Returns the encoding format name for this key.
 java.math.BigInteger getG()
          Returns the base, g.
 java.math.BigInteger getP()
          Returns the prime, p.
 java.math.BigInteger getY()
          Returns the value of y = gx mod p (where x is the private value).
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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

BaseElGamalPublicKey

public BaseElGamalPublicKey(java.math.BigInteger p,
                            java.math.BigInteger g,
                            java.math.BigInteger y)
Constructs a BaseElGamalPublicKey with the specified prime p, base g, and public value y = gx mod p.
Throws:
NullPointerException - if p == null || g == null || y == null

BaseElGamalPublicKey

public BaseElGamalPublicKey(ElGamalParams params,
                            java.math.BigInteger y)
Constructs a BaseElGamalPublicKey with a prime and base taken from an object implementing java.security.interfaces.ElGamalParams, and the specified public value y = gx mod p.
Throws:
NullPointerException - if params == null || y == null
Method Detail

getP

public java.math.BigInteger getP()
Returns the prime, p.
Specified by:
getP in interface ElGamalKey
Returns:
the prime as a java.math.BigInteger

getG

public java.math.BigInteger getG()
Returns the base, g.
Specified by:
getG in interface ElGamalKey
Returns:
the base as a java.math.BigInteger

getY

public java.math.BigInteger getY()
Returns the value of y = gx mod p (where x is the private value).
Specified by:
getY in interface ElGamalKey
Returns:
y as a java.math.BigInteger

getAlgorithm

public java.lang.String getAlgorithm()
Returns the name of the algorithm this key is intended for ("ElGamal").
Specified by:
getAlgorithm in interface java.security.Key

getFormat

public java.lang.String getFormat()
Returns the encoding format name for this key. In the current release this always returns null, because key encoding is not yet supported.
Specified by:
getFormat in interface java.security.Key

getEncoded

public byte[] getEncoded()
Returns an encoding of this key as a byte array. In the current release this always returns null, because key encoding is not yet supported.
Specified by:
getEncoded in interface java.security.Key