|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.security.AlgorithmParametersSpi
|
+--iaik.security.dh.DHParameters
This class represents Diffie Hellman paramters in opaque form and may be used for generating opaque DH parameters and converting them between various formats.
The Diffie Hellman algorithm has been the first public-key algorithm. It only can be used for key-agreement, but not for data encrypting and decrypting.
PKCS#3 describes
a method for implementing the Diffie Hellman key agreement where two (or more)
entities use general Diffie Hellman parameters (an odd prime p, an
integer base g satisfying 0 < g < p,
and optionally an integer l prescribing the length of the private
value), generated from some central authority (which may an entity itself), for
creating a shared secret only known by them.
DHParamters 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
and - if given - length l of the private value x) for initializing
the new AlgorithmParameters object are immediately taken from the given DH
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 Diffie Hellman parameters.
Alternatively DHParamerters may be created by using a proper
AlgorithmParamterGenerator. The DHParameterGenerator itself calls
AlgorithmParameters.getInstance("DH", "IAIK") for actually
generating DHEParameters in opaque representation.
For obtaining DH parameters in transparent representation from an opaque
DHParamters object, the getParameterSpec method can be used;
for obtaining the parameters as DER encoded ASN.1 object, use
getEncoded.
DHParameterGenerator,
AlgorithmParameters,
DHParameterSpec,
DHPublicKey,
DHPrivateKey,
DHKeyPairGenerator,
DHKeyFactory,
DHKeyAgreement| Constructor Summary | |
DHParameters()
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 DH parameters as transparent DH parameter specification of the given class type. |
protected void |
engineInit(AlgorithmParameterSpec paramSpec)
Initializes this DHParameters with prime modulus p, base generator g and
length l of the private value x, derived from the given DHParameterSpec. |
protected void |
engineInit(byte[] params)
Initializes this DHParameters 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 |
public DHParameters()
DHParameters object.
Applications shall use one of the AlgorithmParameter.getInstance
factory methods for obtaining DHParameters.| Method Detail |
protected byte[] engineGetEncoded()
throws IOException
A SEQUENCE ASN.1 object is created for holding prime modulus p,
base generator g, and - if available - length l of the private
value x; subsequently this SEQUENCE object is DER encoded to get the required byte array.
engineGetEncoded in class AlgorithmParametersSpiIOException - if an encoding error occurs
protected byte[] engineGetEncoded(String format)
throws IOException
Format is ignored. Only DER encoding is supported at this time.
Only calls engineGetEncoded()
for returning the DH paramters as DER encoded byte array, regardless of what
is specified in the format string.
engineGetEncoded in class AlgorithmParametersSpiformat - the encoding format; ignoredIOException - if an encoding error occurs
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
throws InvalidParameterSpecException
engineGetParameterSpec in class AlgorithmParametersSpiparamSpec - the desired parameter specification classInvalidParameterSpecException - if the paramters cannot be
converted to the desired parameter specification
protected void engineInit(AlgorithmParameterSpec paramSpec)
throws InvalidParameterSpecException
p, base generator g and
length l of the private value x, derived from the given DHParameterSpec.engineInit in class AlgorithmParametersSpiparamSpec - the parameter specification, which has to be a DHParameterSpecInvalidParameterSpecException - if the given parameter specification is not a DHParameterSpec
protected void engineInit(byte[] params)
throws IOException
From the given byte array an ASN.1 object is created to be parsed for the
required prime modulus p, base generator g and
- if included - length l of the private value x.
engineInit in class AlgorithmParametersSpiparams - the DER encoded byte arrayIOException - if an error occurs when decoding the given byte array
protected void engineInit(byte[] params,
String format)
throws IOException
Only calls engineInit(params) for initializing this
DHParamters object from the given DER encoded byte array, regardless
of what is specified in the format string.
engineInit in class AlgorithmParametersSpiparams - the DER encoded byte arrayformat - the encoding format; ignoredIOException - if an error occurs when decoding the given byte arraypublic int hashCode()
hashCode in class Objectprotected String engineToString()
engineToString in class AlgorithmParametersSpi
|
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). | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK