Oracle Security Developer Tools Crypto Java API Reference
10g (10.1.4.0.1)

B28171-01


oracle.security.crypto.core
Class DSAPublicKey

java.lang.Object
  extended byoracle.security.crypto.core.DSAPublicKey

All Implemented Interfaces:
ASN1Object, java.lang.Cloneable, java.io.Externalizable, Key, PublicKey, java.io.Serializable, Streamable

public class DSAPublicKey
extends java.lang.Object
implements PublicKey, ASN1Object, java.io.Externalizable

A DSA public key.

The OID used to identify the key algorithm may be set via setKeyAlgOID. The encoding used for keys of this class is based on the SubjectPublicKeyInfo structure of X.509, and is compatible with that used in JDK 1.2.

See Also:
DSA, Serialized Form

Constructor Summary
DSAPublicKey()
          Makes a new, uninitialized instance.
DSAPublicKey(ASN1Sequence s)
           
DSAPublicKey(java.math.BigInteger y, DSAParams params)
          Makes a new instance with the given set of parameters and value of y.
DSAPublicKey(byte[] data)
          Makes a new instance by reading its encoding from the given byte array.
DSAPublicKey(java.io.InputStream is)
          Makes a new instance by reading its encoding from the given input stream.

 

Method Summary
 java.lang.Object clone()
          Creates a deep copy of this DSAPublicKey instance.
 void erase()
          Erases the key material making the key un-usable.
 void finalize()
          Erases this object prior to being reclaimed by the garbage collector.
 AlgorithmIdentifier getAlgID()
           
 java.lang.String getAlgorithm()
          Gets the algorithm name for this key.
 int getBitLength()
          Returns the number of bits needed to represent the DSAPublicKey's public component P.
 ASN1Object getContents()
           
 byte[] getEncoded()
          Outputs the encoding of this object to a byte array.
 java.lang.String getFormat()
          Returns a string which indicates the format of this object's encoding.
 ASN1ObjectID getKeyAlgOID()
          Returns the key algorithm OID.
 DSAParams getParams()
          Returns the DSA algorithm parameters for this public key.
 java.math.BigInteger getY()
          Gets y.
 void initialize(AlgorithmIdentifier algID, ASN1Object contents)
           
 void input(ASN1Sequence s)
           
 void input(java.io.InputStream is)
          Inputs a DSAPublicKey object by reading its encoding from the given input stream.
 int length()
          Gets the length of the encoding of this object.
 void output(java.io.OutputStream os)
          Outputs encoding of this object to a given output stream.
 ASN1Sequence outputASN1()
           
 void readExternal(java.io.ObjectInput is)
           
 void setKeyAlgOID(ASN1ObjectID oid)
          Sets the key algorithm OID.
 void setParams(DSAParams params)
          Sets the DSA algorithm parameters for this public key.
 java.lang.String toString()
          Returns a string which describes this object.
 void writeExternal(java.io.ObjectOutput os)
           

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Constructor Detail

DSAPublicKey

public DSAPublicKey()
Makes a new, uninitialized instance.

DSAPublicKey

public DSAPublicKey(java.math.BigInteger y,
                    DSAParams params)
Makes a new instance with the given set of parameters and value of y.
Parameters:
y - the value of y
params - the DSAParams of this DSAPublicKey

DSAPublicKey

public DSAPublicKey(java.io.InputStream is)
             throws java.io.IOException
Makes a new instance by reading its encoding from the given input stream.
Parameters:
is - the input stream from from which this object will be read
Throws:
java.io.IOException - If an input exception occured

DSAPublicKey

public DSAPublicKey(byte[] data)
             throws java.io.IOException
Makes a new instance by reading its encoding from the given byte array.
Parameters:
data - the byte array from which this object will be read
Throws:
java.io.IOException - If an input exception occured

DSAPublicKey

public DSAPublicKey(ASN1Sequence s)
             throws java.io.IOException

Method Detail

initialize

public void initialize(AlgorithmIdentifier algID,
                       ASN1Object contents)
                throws AlgorithmIdentifierException,
                       InvalidInputException
Specified by:
initialize in interface PublicKey
Throws:
AlgorithmIdentifierException
InvalidInputException

getAlgID

public AlgorithmIdentifier getAlgID()
Specified by:
getAlgID in interface PublicKey

getContents

public ASN1Object getContents()
Specified by:
getContents in interface PublicKey

getKeyAlgOID

public ASN1ObjectID getKeyAlgOID()
Returns the key algorithm OID. If no key algorithm OID has been set, then the default, DSA.dsaKeyOID, is returned.
Returns:
the key algorithm OID
See Also:
DSA.dsaKeyOID

setKeyAlgOID

public void setKeyAlgOID(ASN1ObjectID oid)
Sets the key algorithm OID.
Parameters:
oid - the key algorithm OID

getY

public java.math.BigInteger getY()
Gets y.
Returns:
y

setParams

public void setParams(DSAParams params)
Sets the DSA algorithm parameters for this public key.

getParams

public DSAParams getParams()
Returns the DSA algorithm parameters for this public key.
Returns:
the algorithm parameters

input

public void input(java.io.InputStream is)
           throws java.io.IOException
Inputs a DSAPublicKey object by reading its encoding from the given input stream.
Specified by:
input in interface Streamable
Parameters:
is - the input stream from which this object will be read
Throws:
java.io.IOException - If an input exception occured.

input

public void input(ASN1Sequence s)
           throws java.io.IOException
Throws:
java.io.IOException

output

public void output(java.io.OutputStream os)
            throws java.io.IOException
Outputs encoding of this object to a given output stream.
Specified by:
output in interface Streamable
Parameters:
os - the output stream to which the encoding of this object will be written
Throws:
java.io.IOException - If an output exception occured.

outputASN1

public ASN1Sequence outputASN1()

length

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

getAlgorithm

public java.lang.String getAlgorithm()
Gets the algorithm name for this key.
Specified by:
getAlgorithm in interface Key
Returns:
"DSA"

getEncoded

public byte[] getEncoded()
Outputs the encoding of this object to a byte array.
Specified by:
getEncoded in interface Key
Returns:
a the encoding of this object

getBitLength

public int getBitLength()
Returns the number of bits needed to represent the DSAPublicKey's public component P.

0 will be returned if the key has not been initialized.

Specified by:
getBitLength in interface Key

toString

public java.lang.String toString()
Returns a string which describes this object.
Returns:
a string which describes this object

getFormat

public java.lang.String getFormat()
Returns a string which indicates the format of this object's encoding.
Specified by:
getFormat in interface Key
Returns:
"X.509"

erase

public void erase()
Erases the key material making the key un-usable.

Keys can be erased multiple times with no consequence.

Specified by:
erase in interface Key

finalize

public void finalize()
Erases this object prior to being reclaimed by the garbage collector.

Note: There is no guarantee of when, if ever, finalize will be invoked by the Java runtime.


clone

public java.lang.Object clone()
Creates a deep copy of this DSAPublicKey instance.
Specified by:
clone in interface Key

writeExternal

public void writeExternal(java.io.ObjectOutput os)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput is)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

Oracle Security Developer Tools Crypto Java API Reference
10g (10.1.4.0.1)

B28171-01


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