public class DSAParams
extends java.lang.Object
implements java.security.interfaces.DSAParams
NIST's Digital Signature Standard (DSS) specifies the DSA algorithm as public-key algorithm for being used for digital signing applications. For first calculating a hash value of any data to be signed, the Secure Hash Algorithm is proposed to be used along with the DSA algorithm.
The DSA algorithm uses a certain number of parameters:
p
, which length is a multiple of 64 bits lying between
512 and 1024 bits
q
) of p-1
(h(p-1)/q)(mod p) > 1
g = (h(p-1)/q)(mod p)
x
less than q
y
calculated from y = (gx)(mod p)
This class represents the public parameters p
(prime), q
(sub-prime), and g
and, for instance, may be used for algorithm specific
initializing a KeyPairGenerator for generating DSA keys:
DSAParams dsa_params = new DSAParams(p, q, g); dsa_key_gen.initialize(dsa_params, random);
KeyPairGenerator
,
KeyPair
,
DSA
,
RawDSA
,
DSAPublicKey
,
DSAPrivateKey
,
DSAKeyPairGenerator
,
DSAKeyFactory
Constructor and Description |
---|
DSAParams(ASN1Object obj)
Creates a new DSAParams object from the given ASN.1 Object.
|
DSAParams(java.math.BigInteger p,
java.math.BigInteger q,
java.math.BigInteger g)
Creates a new DSAParams object from the given BigInteger
parameters.
|
DSAParams(java.security.interfaces.DSAParams params)
Creates a new DSAParams object from the given DSAParams
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this DSAParams object with the given DSAParams object.
|
java.math.BigInteger |
getG()
Returns the public base value
g as BigInteger. |
java.math.BigInteger |
getP()
Returns the public prime value
p as BigInteger. |
java.math.BigInteger |
getQ()
Returns the public sub-prime value
q as BigInteger. |
int |
hashCode()
Returns a hash code for this DSAParams object.
|
ASN1Object |
toASN1Object()
Returns this DSAParams object as ASN1Object of type SEQUENCE
containing the prime and sub-prime values p and q and the
base value b..
|
java.lang.String |
toString()
Returns a string that represents the contents of this DSAParams.
|
public DSAParams(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g)
p
- the public prime p (of a multiple length of 64 bits between 512
and 1024 bits)q
- the public sub-prime q (a 160-bit prime factor of p-1)g
- the public base g (=(h(p-1)/q)(mod p) > 1, with h < p-1)public DSAParams(java.security.interfaces.DSAParams params)
params
- the DSAParamspublic DSAParams(ASN1Object obj) throws CodingException
This constructor may be used for parsing an already existing
DSAParams
object, supplied as ASN1Object
that may have been created by calling toASN1Object
.
obj
- the DSA parameters as ASN1ObjectCodingException
public java.math.BigInteger getP()
p
as BigInteger.getP
in interface java.security.interfaces.DSAParams
public java.math.BigInteger getQ()
q
as BigInteger.getQ
in interface java.security.interfaces.DSAParams
public java.math.BigInteger getG()
g
as BigInteger.getG
in interface java.security.interfaces.DSAParams
public ASN1Object toASN1Object()
Dss-Parms ::= SEQUENCE { p INTEGER, q INTEGER, g INTEGER }The ASN1Object returned by this method may be used as parameter value when creating a
DSAParams
object using the
DSAParams(ASN1Object obj)
constructor.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the other DSAParams objecttrue
, if the two DSAParams objects are equal, false
otherwisepublic java.lang.String toString()
toString
in class java.lang.Object