Skip navigation links

Oracle Fusion Middleware Crypto FIPS Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10696-05


oracle.security.crypto.core
Class DSAParams

java.lang.Object
  extended by oracle.security.crypto.core.DSAParams

All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.security.interfaces.DSAParams, ASN1Object, Streamable

public class DSAParams
extends java.lang.Object
implements ASN1Object, java.io.Externalizable, java.security.interfaces.DSAParams

Parameters used for the Digital Signature Standard, as described in FIPS 186. The parameter names used here match that reference.

The necessary parameters to implement DSA are:

The following ASN.1 encoding is used, defined in the PKIX draft standard:

            Dss-Parms  ::=  SEQUENCE  {
                p         INTEGER,
                q         INTEGER,
                g         INTEGER  }
    

A DSAParams may also store the seed and counter used to generate p and q.

Warning: The serialization capability of this class should only be used for short-term storage and RMI between applications running the same version of this product. It should not be relied on for long-term perisistence, as future versions of this class may use an incompatible serialization format. For now, applications requiring long-term persistence should use the ASN.1 encodings provided by the input(InputStream) and output(OutputStream) methods directly, instead of serialization.

See Also:
Serialized Form

Constructor Summary
DSAParams()
          Creates a new empty instance.
DSAParams(ASN1Sequence s)
          Creates a new DSAParams object by parsing the given ASN.1 sequence.
DSAParams(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g)
          Creates a new DSAParams object with the given values of p, q, and g.
DSAParams(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g, byte[] seed, int counter, java.math.BigInteger h)
          Creates a new DSAParams object with the given values of p, q, g, seed, counter and h.
DSAParams(java.io.InputStream is)
          Creates a new DSAParams object by reading its encoding from the given input stream.

 

Method Summary
 int getCounter()
          Get the counter that was used generate these parameters.
 java.math.BigInteger getG()
          Gets g.
 java.math.BigInteger getH()
          Gets h.
 java.math.BigInteger getP()
          Gets p.
 java.math.BigInteger getQ()
          Gets q.
 byte[] getSeed()
          Gets the seed that was used generate these parameters.
 void input(ASN1Sequence s)
          Parses a DSAParams object from given ASN1Sequence.
 void input(java.io.InputStream is)
          Reads the encoding of a DSAParams object from given InputStream.
 boolean isValidParams()
          Checks if this DSAParams contains DSA domain parameters generated by the FIPs-approved method as specified in FIPS 186-2.
 int length()
          Returns the length of this object's encoding.
 void output(java.io.OutputStream os)
          Outputs the encoding of this DSAParams object to the given OutputStream.
 ASN1Sequence outputASN1()
          Outputs this DSAParams object to the given ASN1Sequence.
 void readExternal(java.io.ObjectInput is)
          Reads the input stream and initializes the DSA parameters.
 java.lang.String toString()
          Transforms this DSAParams object into a readable string.
 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

DSAParams

public DSAParams()
Creates a new empty instance. This constructor is to be used with serialization or with the input method.

DSAParams

public DSAParams(java.math.BigInteger p,
                 java.math.BigInteger q,
                 java.math.BigInteger g)
Creates a new DSAParams object with the given values of p, q, and g. The seed and counter used to generate p and q are not stored.
Parameters:
p - the large prime p
q - the small prime q
g - the generator g

DSAParams

public DSAParams(java.math.BigInteger p,
                 java.math.BigInteger q,
                 java.math.BigInteger g,
                 byte[] seed,
                 int counter,
                 java.math.BigInteger h)
Creates a new DSAParams object with the given values of p, q, g, seed, counter and h.
Parameters:
p - the large prime p
q - the small prime q
g - the generator g
seed - the seed used to generate p and q.
counter - the counter used to generate p and q.
h - the value used to generate g.

DSAParams

public DSAParams(java.io.InputStream is)
          throws java.io.IOException
Creates a new DSAParams object by reading its encoding from the given input stream.
Parameters:
is - the inputStream where the DSAParam comes from
Throws:
java.io.IOException - If an input exception occured.

DSAParams

public DSAParams(ASN1Sequence s)
          throws java.io.IOException
Creates a new DSAParams object by parsing the given ASN.1 sequence.
Parameters:
s - the ASN1Sequence representing the DSAParams.
Throws:
java.io.IOException - If an input exception occured.

Method Detail

getP

public java.math.BigInteger getP()
Gets p.
Specified by:
getP in interface java.security.interfaces.DSAParams
Returns:
the large prime p; or null if p is not initialized

getQ

public java.math.BigInteger getQ()
Gets q.
Specified by:
getQ in interface java.security.interfaces.DSAParams
Returns:
the small prime q; or null if q is not initialized

getG

public java.math.BigInteger getG()
Gets g.
Specified by:
getG in interface java.security.interfaces.DSAParams
Returns:
the generator g; or null if g is not initialized

getSeed

public byte[] getSeed()
Gets the seed that was used generate these parameters. The seed is not saved or restored on I/O, so it will only be set in an object output by DSAKeyPairGenerator.generateParameters().
Returns:
the seed used to generate p and q; or null if seed is not initialized

getCounter

public int getCounter()
Get the counter that was used generate these parameters. The counter is not saved or restored on I/O, so it will only be set in an object output by DSAKeyPairGenerator.generateParameters().
Returns:
the count used to generate p and q. or null if the count is not initialized

getH

public java.math.BigInteger getH()
Gets h.
Returns:
the generator h; or null if h is not initialized

isValidParams

public boolean isValidParams()
Checks if this DSAParams contains DSA domain parameters generated by the FIPs-approved method as specified in FIPS 186-2.

input

public void input(java.io.InputStream is)
           throws java.io.IOException
Reads the encoding of a DSAParams object from given InputStream.
Specified by:
input in interface Streamable
Parameters:
is - the inputStream where the DSAParam comes from
Throws:
java.io.IOException - If an input exception occured.
See Also:
output(java.io.OutputStream)

input

public void input(ASN1Sequence s)
           throws java.io.IOException
Parses a DSAParams object from given ASN1Sequence.
Parameters:
s - the ASN1Sequence representing the DSAParams.
Throws:
java.io.IOException - If an input exception occured.
See Also:
outputASN1()

output

public void output(java.io.OutputStream os)
            throws java.io.IOException
Outputs the encoding of this DSAParams object to the given OutputStream.
Specified by:
output in interface Streamable
Parameters:
os - the OutputStream where this DSAParams will go
Throws:
java.io.IOException - If an output exception occured.
See Also:
input(InputStream)

outputASN1

public ASN1Sequence outputASN1()
Outputs this DSAParams object to the given ASN1Sequence.
Returns:
the ASN1Sequence representing this DSAParams will go
See Also:
input(ASN1Sequence)

length

public int length()
Returns the length of this object's encoding.
Specified by:
length in interface Streamable
Returns:
the length of this object's encoding.

toString

public java.lang.String toString()
Transforms this DSAParams object into a readable string.
Overrides:
toString in class java.lang.Object
Returns:
a string in readable form representing this DSAParams object

writeExternal

public void writeExternal(java.io.ObjectOutput os)
                   throws java.io.IOException
Writes to the output stream the DER encoding of this object.
Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
os - The output stream to write the encoding to.
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput is)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the input stream and initializes the DSA parameters.
Specified by:
readExternal in interface java.io.Externalizable
Parameters:
is - The stream to read from.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

Skip navigation links

Oracle Fusion Middleware Crypto FIPS Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10696-05


Copyright © 2005, 2013, Oracle. All rights reserved.