|
Oracle Security Developer Tools Crypto Java API Reference 11g (11.1.1) E10668-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.security.crypto.core.DHParams
public class DHParams
Domain parameters for the Diffie-Hellman key agreement scheme, as described in ANSI X9.42.
The Diffie-Hellman domain parameters contain, at a minimum, the subgroup parameters p and q and a the generator element g; optionally they may also contain an integer j (such that j >= 2 and p = jq + 1, and known as the cofactor of p-1 and q), and validation parameters seed, pGenCounter used to verify the subgroup parameters using the normative generation procedure given in Annex B.
The ASN1 syntax for a DHParams object is as follows:
DomainParameters ::= Sequence { p INTEGER, -- odd prime, p = jq+1 g INTEGER, -- generator, g^q = 1 mod p q INTEGER, -- prime factor of p-1 j INTEGER OPTIONAL, -- cofactor, j>=2 validationParms ValidationParms OPTIONAL } ValidationalParms ::= Sequence { seed BITSTRING, -- seed for prime generation pGenCounter INTEGER, -- parameter verification }
DHParameterGenerator
, DHKeyAgreement
, Serialized FormConstructor Summary | |
---|---|
DHParams(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q) Constructs a new DHParams instance with the give value of p, g and q. |
|
DHParams(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q, java.math.BigInteger j) Constructs a new DHParams instance with the give value of p, g, q and j. |
|
DHParams(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q, java.math.BigInteger j, byte[] seed, int pgenCounter) Constructs a new DHParams instance with the give value of p, g, q, j and validation parameters seed, pgenCounter. |
|
DHParams(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q, byte[] seed, int pgenCounter) Constructs a new DHParams instance with the give value of p, g, q and validation parameters seed, pgenCounter. |
|
DHParams(java.io.InputStream is) Constructs a new DHParams from the given input stream encoding the parameters. |
Method Summary | |
---|---|
java.math.BigInteger |
getG() Returns the group generator g. |
java.math.BigInteger |
getJ() Returns the cofactor j. |
java.math.BigInteger |
getP() Returns the prime p defining the Galois Field GF(p). |
int |
getPGenCounter() Returns the counter value pGenCounter (greater than zero), used to generate the domain parameters (p, q, g). |
java.math.BigInteger |
getQ() Returns the prime q, specifying the multiplicative subgroup of order q in GF(p). |
byte[] |
getSeed() Returns the seed bytes that was used generate these parameters. |
void |
input(java.io.InputStream is) Inputs a DHParams object by reading its encoding from the given input stream. |
static boolean |
isValidParams(DHParams params, int L, int m) Verifies that the domain parameters (p, q, g) can be reconstructed using the normative generation procedure given in Annex B of X9.42, using the validation parameters seed and pGenCounter and that p and q have bitlengths corresponding to the prescribed strength values L and m. |
int |
length() Returns the length of the ASN1 encoding of this object. |
void |
output(java.io.OutputStream os) Outputs the ASN1 encoding of this object to a given output stream. |
void |
readExternal(java.io.ObjectInput is) Reads the input stream and initializes the Diffie Hellman parameters. |
java.lang.String |
toString() Returns a string representation of this object. |
void |
writeExternal(java.io.ObjectOutput os) Writes to the output stream the DER encoding of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DHParams(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q)
DHParams
instance with the give value of p, g and q.
p
- pg
- gq
- qpublic DHParams(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q, java.math.BigInteger j)
DHParams
instance with the give value of p, g, q and j.
p
- pg
- gq
- qj
- jpublic DHParams(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q, byte[] seed, int pgenCounter)
DHParams
instance with the give value of p, g, q and validation parameters seed, pgenCounter.
p
- pg
- gq
- qseed
- the seed value used in generating p, q.pgenCounter
- the counter in generating ppublic DHParams(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q, java.math.BigInteger j, byte[] seed, int pgenCounter)
DHParams
instance with the give value of p, g, q, j and validation parameters seed, pgenCounter.
p
- pg
- gq
- qj
- jseed
- the seed value used in generating p, q.pgenCounter
- the counter in generating ppublic DHParams(java.io.InputStream is) throws java.io.IOException
DHParams
from the given input stream encoding the parameters.
is
- the input stream from which the parameters derived.java.io.IOException
Method Detail |
---|
public java.math.BigInteger getP()
public java.math.BigInteger getQ()
public java.math.BigInteger getG()
public java.math.BigInteger getJ()
null
, if not.public byte[] getSeed()
null
if not.public int getPGenCounter()
public java.lang.String toString()
toString
in class java.lang.Object
public static boolean isValidParams(DHParams params, int L, int m)
Additionally, if the optional cofactor j is provided, its relations to p and q are also verifed.
Finally, it should be noted that since the procedure for parameter verification essentially follows the same steps as for parameter generation, the operation is similarly resource intensive
params
- a DHParams
object to be validated.L
- the strength of p in bits; L=256n with n >= 4m
- the strength of q in bits; m >= 160true
if the parameters are valid (and match the given strength parameters), otherwise returns false
.java.lang.IllegalArgumentException
- If the values L and/or m are invalid, or if either of seed and pGenCounter are missing from the params.DHParameterGenerator
public void input(java.io.InputStream is) throws java.io.IOException
DHParams
object by reading its encoding from the given input stream.input
in interface Streamable
is
- The input stream from which this object will be readjava.io.IOException
- If an input exception occured.public void output(java.io.OutputStream os) throws java.io.IOException
output
in interface Streamable
os
- The output stream to which the encoding of this object will be written.java.io.IOException
- If an output exception occured.public int length()
length
in interface Streamable
public void writeExternal(java.io.ObjectOutput os) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
os
- The output stream to write the encoding to.java.io.IOException
public void readExternal(java.io.ObjectInput is) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
is
- The stream to read from.java.io.IOException
java.lang.ClassNotFoundException
|
Oracle Security Developer Tools Crypto Java API Reference 11g (11.1.1) E10668-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |