Skip navigation links

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

E10696-04


oracle.security.crypto.core
Class DSAPublicKey

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

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

public class DSAPublicKey
extends java.lang.Object
implements PublicKey, ASN1Object, java.security.interfaces.DSAPublicKey

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

Field Summary

 

Fields inherited from interface java.security.interfaces.DSAPublicKey
serialVersionUID

 

Constructor Summary
DSAPublicKey()
          Makes a new, uninitialized instance.
DSAPublicKey(ASN1Sequence s)
          Deprecated. Use DSAPublicKey(InputStream is) instead.
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 sensitive key material of a private or symmetric key, making the key un-usable.
 void finalize()
          Erases this object prior to being reclaimed by the garbage collector.
 AlgorithmIdentifier getAlgID()
          Returns the algorithm identifier for this key.
 java.lang.String getAlgorithm()
          Gets the algorithm name for this key.
 boolean getAllowExport()
          Always returns true.
 int getBitLength()
          Returns the number of bits needed to represent the DSAPublicKey's public component P.
 ASN1Object getContents()
          Returns the contents of this key.
 byte[] getEncoded()
          Returns the encoded form of this key.
 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)
          Initializes this instance from the given algorithm paramters and key contents.
 void input(ASN1Sequence s)
          Deprecated. use input(InputStream is) instead.
 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.
 void readExternal(java.io.ObjectInput is)
          Reads the input stream and initializes the DSA public key.
 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)
          Writes to the output stream the DER encoding of this object.

 

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(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(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(ASN1Sequence s)
             throws java.io.IOException
Deprecated. Use DSAPublicKey(InputStream is) instead.
Throws:
java.io.IOException

Method Detail

getEncoded

public byte[] getEncoded()
Description copied from interface: Key
Returns the encoded form of this key.
Specified by:
getEncoded in interface java.security.Key

getAlgorithm

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

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.


getFormat

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

erase

public void erase()
Description copied from interface: Key
Erases the sensitive key material of a private or symmetric key, making the key un-usable. Keys may be erased multiple times with no consequences.

Note: After erase() has been invoked, no other methods of the Key object are guaranteed to function correctly. In particular, invoking another method after erase() may result in a NullPointerException being thrown.


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.

Overrides:
finalize in class java.lang.Object

clone

public java.lang.Object clone()
Creates a deep copy of this DSAPublicKey instance.
Overrides:
clone in class java.lang.Object
Returns:
A deep clone of the Key instance.

getAllowExport

public boolean getAllowExport()
Always returns true.
Returns:
Whether or not this key's material may be exported in plaintext.
Since:
3.0
See Also:
FIPS_140_2.getAllowKeyExport()

initialize

public void initialize(AlgorithmIdentifier algID,
                       ASN1Object contents)
                throws AlgorithmIdentifierException,
                       InvalidInputException
Description copied from interface: PublicKey
Initializes this instance from the given algorithm paramters and key contents.
Throws:
AlgorithmIdentifierException
InvalidInputException

getAlgID

public AlgorithmIdentifier getAlgID()
Description copied from interface: PublicKey
Returns the algorithm identifier for this key.

getContents

public ASN1Object getContents()
Description copied from interface: PublicKey
Returns the contents of this key.

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.
Specified by:
getY in interface java.security.interfaces.DSAPublicKey
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.
Specified by:
getParams in interface java.security.interfaces.DSAKey
Returns:
the algorithm parameters

toString

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

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
Deprecated. use input(InputStream is) instead.
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.

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.

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 public key.
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-04


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