|
Oracle Security Developer Tools Crypto Java API Reference 10g Release 2 (10.1.2.0.2) B15565-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.security.crypto.core.DSAPrivateKey
A DSA private key.
A DSA private key contains, in addition to the DSA parameters p, q, and g, an additional integer, x.
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 PrivateKeyInfo structure of PKCS #8, and is compatible with that used in JDK 1.2.
Note: To input a DSA private key (e.g., from a file), it is preferred to use CryptoUtils.inputPrivateKey
. This method is required to input a CDSA format DSA private key.
CryptoUtils.inputPrivateKey(java.io.File)
, Serialized FormConstructor Summary | |
DSAPrivateKey() Makes a new, uninitialized instance. |
|
DSAPrivateKey(ASN1Sequence s) |
|
DSAPrivateKey(java.math.BigInteger x, DSAParams params) Makes a new instance with the give value of x and DSAParams . |
|
DSAPrivateKey(byte[] data) Makes a new instance by reading its encoding from the given byte array |
|
DSAPrivateKey(java.io.File f) Makes a new instance by reading its encoding from the given file. |
|
DSAPrivateKey(java.io.InputStream is) Makes a new instance by reading its encoding from the given InputStream. |
Method Summary | |
java.lang.Object |
clone() Creates a deep copy of this DSAPrivateKey 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() Returns the algorithm identifier for this key. |
java.lang.String |
getAlgorithm() Gets the algorithm name for this key. |
int |
getBitLength() Returns the number of bits needed to represent the DSAPrivateKey's public component P. |
ASN1Object |
getContents() Returns the contents of this key. |
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 private key. |
java.math.BigInteger |
getX() Gets x. |
void |
initialize(AlgorithmIdentifier algID, ASN1Object contents) Initializes this instance from the given algorithm paramters and key contents. |
void |
input(ASN1Sequence s) |
void |
input(java.io.InputStream is) Inputs a DSAPrivateKey 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() Returns the ASN1 encoding of this object. |
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() |
void |
writeExternal(java.io.ObjectOutput os) |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public DSAPrivateKey()
public DSAPrivateKey(java.math.BigInteger x, DSAParams params)
DSAParams
.x
- xparams
- the DSAParams
of this DSAPrivateKey
public DSAPrivateKey(java.io.InputStream is) throws java.io.IOException
is
- the InputStream from which the DSAPrivateKey object comesjava.io.IOException
- If an input exception occured.public DSAPrivateKey(java.io.File f) throws java.io.IOException
f
- the file stores a DSAPrivateKey objectjava.io.IOException
- If an input exception occured.public DSAPrivateKey(byte[] data) throws java.io.IOException
data
- the byte array from which the DSAPrivateKey object comesjava.io.IOException
- If an input exception occured.public DSAPrivateKey(ASN1Sequence s) throws java.io.IOException
Method Detail |
public void initialize(AlgorithmIdentifier algID, ASN1Object contents) throws AlgorithmIdentifierException, InvalidInputException
PrivateKey
initialize
in interface PrivateKey
AlgorithmIdentifierException
InvalidInputException
public AlgorithmIdentifier getAlgID()
PrivateKey
getAlgID
in interface PrivateKey
public ASN1Object getContents()
PrivateKey
getContents
in interface PrivateKey
public java.math.BigInteger getX()
public void setParams(DSAParams params)
public DSAParams getParams()
public void input(java.io.InputStream is) throws java.io.IOException
DSAPrivateKey
object by reading its encoding from the given input stream.input
in interface Streamable
is
- the input stream from which this object will be readjava.io.IOException
- If an input exception occured.public void input(ASN1Sequence s) throws java.io.IOException
java.io.IOException
public java.lang.String getFormat()
getFormat
in interface Key
public java.lang.String getAlgorithm()
getAlgorithm
in interface Key
public byte[] getEncoded()
getEncoded
in interface Key
public int getBitLength()
0 will be returned if the key has not been initialized.
getBitLength
in interface Key
public java.lang.String toString()
public ASN1ObjectID getKeyAlgOID()
DSA.dsaKeyOID
, is returned.DSA.dsaKeyOID
public void setKeyAlgOID(ASN1ObjectID oid)
oid
- the key algorithm OIDpublic void erase()
Keys can be erased multiple times with no consequence.
erase
in interface Key
public void finalize()
Note: There is no guarantee of when, if ever, finalize
will be invoked by the Java runtime.
public java.lang.Object clone()
DSAPrivateKey
instance.clone
in interface Key
public void output(java.io.OutputStream os) throws java.io.IOException
output
in interface Streamable
os
- he output stream to which the encoding of this object will be writtenjava.io.IOException
- If an output exception occured.public ASN1Sequence outputASN1()
public int length()
length
in interface Streamable
public void writeExternal(java.io.ObjectOutput os) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput is) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
|
Oracle Security Developer Tools Crypto Java API Reference 10g Release 2 (10.1.2.0.2) B15565-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |