iaik.security.dh
Class ESDHParameters

java.lang.Object
  |
  +--java.security.AlgorithmParametersSpi
        |
        +--iaik.security.dh.DHParameters
              |
              +--iaik.security.dh.ESDHParameters

public class ESDHParameters
extends DHParameters

This class represents Ephmeral-Static Diffie Hellman paramters in opaque form and may be used for generating opaque ESDH parameters and converting them between various formats.

ESDHParamters may be generated provider independently by calling one of the AlgorithmParameters.getInstance methods and subsequently initialzing the new AlgorithmParamters object with proper DH parameter specification or DER encoded byte array. If the first way is chosen, the parameter values (prime modulus p, base generator g, prime factor q, the subgroup factor j (if available) and the seed seed and pgenCounter pgenCounter (if available)) for initializing the new AlgorithmParameters object are immediately taken from the given ESDH parameter specification; if the parameters are given as DER encoded byte array, an ASN.1 object is created from this byte array for subsequently parsing it to get the ESDH parameters.

Alternatively ESDHParamerters may be created by using a proper AlgorithmParamterGenerator. The ESDHParameterGenerator itself calls AlgorithmParameters.getInstance("ESDH", "IAIK") for actually generating ESDHParameters in opaque representation.

For obtaining ESDH parameters in transparent representation from an opaque ESDHParamters object, the getParameterSpec method can be used; for obtaining the parameters as DER encoded ASN.1 object, use getEncoded.

Version:
File Revision 11
See Also:
AlgorithmParameters, ESDHParameterGenerator, ESDHParameterSpec, ESDHPublicKey, ESDHPrivateKey, ESDHKeyPairGenerator, ESDHKeyFactory, ESDHKeyAgreement

Constructor Summary
ESDHParameters()
          The default constructor.
 
Method Summary
protected  byte[] engineGetEncoded()
          Returns the parameters as DER byte array.
protected  byte[] engineGetEncoded(String format)
          Returns the parameters as DER byte array.
protected  AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
          Returns the ESDH parameters as transparent ESDH parameter specification of the given class type.
protected  void engineInit(AlgorithmParameterSpec paramSpec)
          Initializes this ESDHParameters with prime modulus p, base generator g, prime factor q, the subgroup factor j (if available) and the seed seed and pgenCounter pgenCounter (if available).
protected  void engineInit(byte[] params)
          Initializes this ESDHParameters object from the given DER encoded byte array.
protected  void engineInit(byte[] params, String format)
          Inits the parameters from a DER encoded byte array.
protected  String engineToString()
          Returns a String representation of the parameters.
 int hashCode()
          Returns a hash code for this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ESDHParameters

public ESDHParameters()
The default constructor. Only internally used for creating a ESDHParameters object. Applications shall use one of the AlgorithmParameter.getInstance factory methods for obtaining DHParameters.
Method Detail

engineGetEncoded

protected byte[] engineGetEncoded()
                           throws IOException
Returns the parameters as DER byte array.

A SEQUENCE ASN.1 object is created for holding prime modulus p, base generator g, prime factor q, the subgroup factor j (if available) and the seed seed and pgenCounter pgenCounter (if available). subsequently this SEQUENCE object is DER encoded to get the required byte array.

Overrides:
engineGetEncoded in class DHParameters
Returns:
the ESDH parameters as DER byte array
Throws:
IOException - if an encoding error occurs

engineGetEncoded

protected byte[] engineGetEncoded(String format)
                           throws IOException
Returns the parameters as DER byte array.

Format is ignored. Only DER encoding is supported at this time. Only calls engineGetEncoded() for returning the ESDH paramters as DER encoded byte array, regardless of what is specified in the format string.

Overrides:
engineGetEncoded in class DHParameters
Parameters:
format - the encoding format; ignored
Returns:
the ESDH parameters as DER byte array
Throws:
IOException - if an encoding error occurs

engineGetParameterSpec

protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
                                                 throws InvalidParameterSpecException
Returns the ESDH parameters as transparent ESDH parameter specification of the given class type.

Overrides:
engineGetParameterSpec in class DHParameters
Parameters:
paramSpec - the desired parameter specification class
Returns:
the ESDH parameters as AlgorithmParaneterSpec
Throws:
InvalidParameterSpecException - if the paramters cannot be converted to the desired parameter specification

engineInit

protected void engineInit(AlgorithmParameterSpec paramSpec)
                   throws InvalidParameterSpecException
Initializes this ESDHParameters with prime modulus p, base generator g, prime factor q, the subgroup factor j (if available) and the seed seed and pgenCounter pgenCounter (if available).
Overrides:
engineInit in class DHParameters
Parameters:
paramSpec - the parameter specification, which has to be a ESDHParameterSpec
Throws:
InvalidParameterSpecException - if the given parameter specification is not a ESDHParameterSpec

engineInit

protected void engineInit(byte[] params)
                   throws IOException
Initializes this ESDHParameters object from the given DER encoded byte array.

From the given byte array an ASN.1 object is created to be parsed for the required prime modulus p, base generator g, prime factor q, the subgroup factor j (if available) and the seed seed and pgenCounter pgenCounter (if available).

Overrides:
engineInit in class DHParameters
Parameters:
params - the DER encoded byte array
Throws:
IOException - if an error occurs when decoding the given byte array

engineInit

protected void engineInit(byte[] params,
                          String format)
                   throws IOException
Inits the parameters from a DER encoded byte array. Format is ignored.

Only calls engineInit(params) for initializing this ESDHParamters object from the given DER encoded byte array, regardless of what is specified in the format string.

Overrides:
engineInit in class DHParameters
Parameters:
params - the DER encoded byte array
format - the encoding format; ignored
Throws:
IOException - if an error occurs when decoding the given byte array

hashCode

public int hashCode()
Returns a hash code for this object.
Overrides:
hashCode in class DHParameters
Returns:
the hash code

engineToString

protected String engineToString()
Returns a String representation of the parameters.
Overrides:
engineToString in class DHParameters
Returns:
a String representation of this DHParameters object

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK