iaik.security.dsa
Class DSAParams

java.lang.Object
  |
  +--iaik.security.dsa.DSAParams
All Implemented Interfaces:
DSAParams

public class DSAParams
extends Object
implements DSAParams

An implementation of DSA parameters that supports ASN.1 encoding. The Digital Signature Algorithm (DSA) only can be used for digital signing (respectively signature verifying). It cannot be used for data encryption.

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, q, g are made public, y forms the public key, and x represents the private key. The procedures of signing some message with one entity´s private key, and verifying a signature using the signer´s public key may be read up in "Applied Cryptography", Bruce Schneier, ISBN 0-471-59756-2).

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);
 

(See http://java.sun.com/products/JDK/1.1/docs/guide/security/CryptoSpec.html)

Version:
File Revision 18
See Also:
KeyPairGenerator, KeyPair, DSA, RawDSA, DSAPublicKey, DSAPrivateKey, DSAKeyPairGenerator, DSAKeyFactory

Constructor Summary
DSAParams(ASN1Object obj)
          Creates a new DSAParams object from the given ASN.1 Object.
DSAParams(BigInteger p, BigInteger q, BigInteger g)
          Creates a new DSAParams object from the given BigInteger parameters.
DSAParams(DSAParams params)
          Creates a new DSAParams object from the given DSAParams
 
Method Summary
 boolean equals(Object obj)
          Compares this DSAParams object with the given DSAParams object.
 BigInteger getG()
          Returns the public base value g as BigInteger.
 BigInteger getP()
          Returns the public prime value p as BigInteger.
 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.
 String toString()
          Returns a string that represents the contents of this DSAParams.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DSAParams

public DSAParams(BigInteger p,
                 BigInteger q,
                 BigInteger g)
Creates a new DSAParams object from the given BigInteger parameters.
Parameters:
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)

DSAParams

public DSAParams(DSAParams params)
Creates a new DSAParams object from the given DSAParams
Parameters:
params - the DSAParams

DSAParams

public DSAParams(ASN1Object obj)
          throws CodingException
Creates a new DSAParams object from the given ASN.1 Object.

This constructor may be used for parsing an already exisiting DSAParams object, supplied as ASN1Object that may have been created by calling toASN1Object.

Parameters:
obj - the DSA parameters as ASN1Object
Method Detail

getP

public BigInteger getP()
Returns the public prime value p as BigInteger.
Specified by:
getP in interface DSAParams
Returns:
the prime value p

getQ

public BigInteger getQ()
Returns the public sub-prime value q as BigInteger.
Specified by:
getQ in interface DSAParams
Returns:
the sub-prime value q

getG

public BigInteger getG()
Returns the public base value g as BigInteger.
Specified by:
getG in interface DSAParams
Returns:
the base value g

toASN1Object

public ASN1Object toASN1Object()
Returns this DSAParams object as ASN1Object of type SEQUENCE.

The ASN1Object returned by this method may be used as parameter value when creating a DSAParams object using the DSAParams(ASN1Object obj) constructor.

Returns:
this DSAParams object as ASN1Object

hashCode

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

equals

public boolean equals(Object obj)
Compares this DSAParams object with the given DSAParams object.
Overrides:
equals in class Object
Parameters:
obj - the other DSAParams object
Returns:
true, if the two DSAParams objects are equal, false otherwise

toString

public String toString()
Returns a string that represents the contents of this DSAParams.
Overrides:
toString in class Object
Returns:
the string representation

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