de.flexiprovider.core.elgamal
Class ElGamalPublicKey

java.lang.Object
  |
  +--de.flexiprovider.api.keys.PublicKey
        |
        +--de.flexiprovider.core.elgamal.ElGamalPublicKey
All Implemented Interfaces:
java.security.Key, Key, java.security.PublicKey, java.io.Serializable

public class ElGamalPublicKey
extends PublicKey

This class implements the PublicKey interface. It is normally instantiated from ElGamalKeyPairGenerator. The public key consists of a modulus p (a prime), a generator of (Zp/Z)* and the public value A = ga mod p, a is the private exponent.

Author:
Thomas Wahrenbruch
See Also:
ElGamalKeyPairGenerator, Serialized Form

Fields inherited from interface java.security.Key
serialVersionUID
 
Fields inherited from interface java.security.PublicKey
serialVersionUID
 
Constructor Summary
protected ElGamalPublicKey(ElGamalPublicKeySpec keySpec)
          Construct an ElGamalPublicKey out of the given key specification.
protected ElGamalPublicKey(FlexiBigInt modulus, FlexiBigInt generator, FlexiBigInt publicA)
          The constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAlgorithm()
          Return the algorithm name.
protected  codec.asn1.ASN1Type getAlgParams()
           
 FlexiBigInt getGenerator()
           
protected  byte[] getKeyData()
           
 FlexiBigInt getModulus()
           
protected  codec.asn1.ASN1ObjectIdentifier getOID()
           
 FlexiBigInt getPublicA()
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class de.flexiprovider.api.keys.PublicKey
getEncoded, getFormat
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ElGamalPublicKey

protected ElGamalPublicKey(FlexiBigInt modulus,
                           FlexiBigInt generator,
                           FlexiBigInt publicA)
The constructor.
Parameters:
modulus - - the prime modulus which specifies the group
generator - - a generator of the group
publicA - - the public value A = ga mod modulus

ElGamalPublicKey

protected ElGamalPublicKey(ElGamalPublicKeySpec keySpec)
Construct an ElGamalPublicKey out of the given key specification.
Parameters:
keySpec - the key specification
Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Return the algorithm name.
Returns:
"ElGamal"

getModulus

public FlexiBigInt getModulus()
Returns:
the prime modulus

getGenerator

public FlexiBigInt getGenerator()
Returns:
the generator

getPublicA

public FlexiBigInt getPublicA()
Returns:
the public value A = ga mod modulus

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a human readable form of the key

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getOID

protected codec.asn1.ASN1ObjectIdentifier getOID()
Overrides:
getOID in class PublicKey
Returns:
the OID to encode in the SubjectPublicKeyInfo structure

getAlgParams

protected codec.asn1.ASN1Type getAlgParams()
Overrides:
getAlgParams in class PublicKey
Returns:
the algorithm parameters to encode in the SubjectPublicKeyInfo structure

getKeyData

protected byte[] getKeyData()
Overrides:
getKeyData in class PublicKey
Returns:
the keyData to encode in the SubjectPublicKeyInfo structure