de.flexiprovider.core.elgamal
Class ElGamalPrivateKey

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

public class ElGamalPrivateKey
extends PrivateKey

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

Author:
Thomas Wahrenbruch
See Also:
ElGamalKeyPairGenerator, Serialized Form

Fields inherited from interface java.security.Key
serialVersionUID
 
Fields inherited from interface java.security.PrivateKey
serialVersionUID
 
Constructor Summary
protected ElGamalPrivateKey(ElGamalPrivateKeySpec keySpec)
          Construct an ElGamalPublicKey out of the given key specification.
protected ElGamalPrivateKey(FlexiBigInt modulus, FlexiBigInt generator, FlexiBigInt publicA, FlexiBigInt a)
          The constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 FlexiBigInt getA()
           
 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.PrivateKey
getEncoded, getFormat
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ElGamalPrivateKey

protected ElGamalPrivateKey(FlexiBigInt modulus,
                            FlexiBigInt generator,
                            FlexiBigInt publicA,
                            FlexiBigInt a)
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
a - - the private value a

ElGamalPrivateKey

protected ElGamalPrivateKey(ElGamalPrivateKeySpec 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

getA

public FlexiBigInt getA()
Returns:
the private value a

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 PrivateKey
Returns:
the OID to encode in the SubjectPublicKeyInfo structure

getAlgParams

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

getKeyData

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