Class DSAPrivateKey
- java.lang.Object
-
- org.mozilla.jss.netscape.security.pkcs.PKCS8Key
-
- org.mozilla.jss.netscape.security.provider.DSAPrivateKey
-
- All Implemented Interfaces:
java.io.Serializable
,java.security.interfaces.DSAKey
,java.security.interfaces.DSAPrivateKey
,java.security.Key
,java.security.PrivateKey
,javax.security.auth.Destroyable
public final class DSAPrivateKey extends PKCS8Key implements java.security.interfaces.DSAPrivateKey, java.io.Serializable
A PKCS#8 private key for the Digital Signature Algorithm.- See Also:
DSAPublicKey
,AlgIdDSA
, Serialized Form
-
-
Field Summary
-
Fields inherited from class org.mozilla.jss.netscape.security.pkcs.PKCS8Key
algid, encodedKey, key, VERSION
-
-
Constructor Summary
Constructors Constructor Description DSAPrivateKey()
DSAPrivateKey(byte[] encoded)
Make a DSA private key from its DER encoding (PKCS #8).DSAPrivateKey(java.math.BigInteger x, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g)
Make a DSA private key out of a private key and three parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Compares two private keys.java.security.interfaces.DSAParams
getParams()
Returns the DSA parameters associated with this key, or null if the parameters could not be parsed.java.math.BigInteger
getX()
Get the raw private key, x, without the parameters.int
hashCode()
Calculates a hash code value for this object.protected void
parseKeyBits()
Parse the key bits.java.lang.String
toString()
-
Methods inherited from class org.mozilla.jss.netscape.security.pkcs.PKCS8Key
buildPKCS8Key, decode, decode, encode, encode, getAlgorithm, getAlgorithmId, getEncoded, getFormat, parse
-
-
-
-
Constructor Detail
-
DSAPrivateKey
public DSAPrivateKey()
-
DSAPrivateKey
public DSAPrivateKey(java.math.BigInteger x, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g) throws java.security.InvalidKeyException
Make a DSA private key out of a private key and three parameters.- Throws:
java.security.InvalidKeyException
-
DSAPrivateKey
public DSAPrivateKey(byte[] encoded) throws java.security.InvalidKeyException
Make a DSA private key from its DER encoding (PKCS #8).- Throws:
java.security.InvalidKeyException
-
-
Method Detail
-
getParams
public java.security.interfaces.DSAParams getParams()
Returns the DSA parameters associated with this key, or null if the parameters could not be parsed.- Specified by:
getParams
in interfacejava.security.interfaces.DSAKey
-
getX
public java.math.BigInteger getX()
Get the raw private key, x, without the parameters.- Specified by:
getX
in interfacejava.security.interfaces.DSAPrivateKey
-
parseKeyBits
protected void parseKeyBits() throws java.security.InvalidKeyException
Description copied from class:PKCS8Key
Parse the key bits. This may be redefined by subclasses to take advantage of structure within the key. For example, RSA public keys encapsulate two unsigned integers (modulus and exponent) as DER values within thekey
bits; Diffie-Hellman and DSS/DSA keys encapsulate a single unsigned integer.This function is called when creating PKCS#8 SubjectPublicKeyInfo values using the PKCS8Key member functions, such as
parse
anddecode
.- Overrides:
parseKeyBits
in classPKCS8Key
- Throws:
java.security.InvalidKeyException
- if the key encoding is invalid.
-
hashCode
public int hashCode()
Description copied from class:PKCS8Key
Calculates a hash code value for this object. Objects which are equal will also have the same hashcode.
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:PKCS8Key
Compares two private keys. This returns false if the object with which to compare is not of typeKey
. Otherwise, the encoding of this key object is compared with the encoding of the given key object.
-
-