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 booleanequals(java.lang.Object obj)Compares two private keys.java.security.interfaces.DSAParamsgetParams()Returns the DSA parameters associated with this key, or null if the parameters could not be parsed.java.math.BigIntegergetX()Get the raw private key, x, without the parameters.inthashCode()Calculates a hash code value for this object.protected voidparseKeyBits()Parse the key bits.java.lang.StringtoString()-
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.InvalidKeyExceptionMake a DSA private key out of a private key and three parameters.- Throws:
java.security.InvalidKeyException
-
DSAPrivateKey
public DSAPrivateKey(byte[] encoded) throws java.security.InvalidKeyExceptionMake 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:
getParamsin interfacejava.security.interfaces.DSAKey
-
getX
public java.math.BigInteger getX()
Get the raw private key, x, without the parameters.- Specified by:
getXin interfacejava.security.interfaces.DSAPrivateKey
-
parseKeyBits
protected void parseKeyBits() throws java.security.InvalidKeyExceptionDescription copied from class:PKCS8KeyParse 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 thekeybits; 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
parseanddecode.- Overrides:
parseKeyBitsin classPKCS8Key- Throws:
java.security.InvalidKeyException- if the key encoding is invalid.
-
hashCode
public int hashCode()
Description copied from class:PKCS8KeyCalculates 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:PKCS8KeyCompares 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.
-
-