|
Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10668-03 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
javax.crypto.spec.DHParameterSpec
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 Form| Constructor 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 javax.crypto.spec.DHParameterSpec |
|---|
getL |
| 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 - q
public 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 - j
public 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 p
public 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 p
public 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()
getP in class javax.crypto.spec.DHParameterSpecpublic java.math.BigInteger getQ()
public java.math.BigInteger getG()
getG in class javax.crypto.spec.DHParameterSpecpublic 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 Streamableis - 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 Streamableos - 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.Externalizableos - 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.Externalizableis - The stream to read from.java.io.IOExceptionjava.lang.ClassNotFoundException
|
Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10668-03 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||