Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.security.key.dss
Class DSSKey  view DSSKey download DSSKey.java

java.lang.Object
  extended bygnu.java.security.key.dss.DSSKey
All Implemented Interfaces:
java.security.interfaces.DSAKey, java.security.Key, java.io.Serializable
Direct Known Subclasses:
DSSPrivateKey, DSSPublicKey

public abstract class DSSKey
extends java.lang.Object
implements java.security.Key, java.security.interfaces.DSAKey

A base asbtract class for both public and private DSS (Digital Signature Standard) keys. It encapsulates the three DSS numbers: p, q and g.

According to the JDK, cryptographic Keys all have a format. The format used in this implementation is called Raw, and basically consists of the raw byte sequences of algorithm parameters. The exact order of the byte sequences and the implementation details are given in each of the relevant getEncoded() methods of each of the private and public keys.


Field Summary
protected  int defaultFormat
          Identifier of the default encoding format to use when externalizing the key material.
protected  java.math.BigInteger g
          g = h(p-1)/q mod p, where h is any integer with 1 < h < p - 1 such that h (p-1)/q mod p > 1 (g has order q mod p ).
protected  java.math.BigInteger p
          A prime modulus, where 2L-1 < p < 2L for 512 <= L <= 1024 and L a multiple of 64.
protected  java.math.BigInteger q
          A prime divisor of p - 1, where 2159 < q < 2160.
private  java.lang.String str
          String representation of this key.
 
Fields inherited from interface java.security.Key
serialVersionUID
 
Constructor Summary
protected DSSKey(int defaultFormat, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g)
          Trivial protected constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the designated object is an instance of java.security.interfaces.DSAKey and has the same DSS (Digital Signature Standard) parameter values as this one.
 java.lang.String getAlgorithm()
          This method returns the name of the algorithm for this key.
 byte[] getEncoded()
          This method returns the encoded form of the key.
abstract  byte[] getEncoded(int format)
           
 java.lang.String getFormat()
          This method returns the name of the encoding format for this key.
 java.security.interfaces.DSAParams getParams()
          This method returns non-secret parameters of the DSA key
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

p

protected final java.math.BigInteger p
A prime modulus, where 2L-1 < p < 2L for 512 <= L <= 1024 and L a multiple of 64.


q

protected final java.math.BigInteger q
A prime divisor of p - 1, where 2159 < q < 2160.


g

protected final java.math.BigInteger g
g = h(p-1)/q mod p, where h is any integer with 1 < h < p - 1 such that h (p-1)/q mod p > 1 (g has order q mod p ).


defaultFormat

protected final int defaultFormat
Identifier of the default encoding format to use when externalizing the key material.


str

private transient java.lang.String str
String representation of this key. Cached for speed.

Constructor Detail

DSSKey

protected DSSKey(int defaultFormat,
                 java.math.BigInteger p,
                 java.math.BigInteger q,
                 java.math.BigInteger g)
Trivial protected constructor.

Method Detail

getParams

public java.security.interfaces.DSAParams getParams()
Description copied from interface: java.security.interfaces.DSAKey
This method returns non-secret parameters of the DSA key

Specified by:
getParams in interface java.security.interfaces.DSAKey

getAlgorithm

public java.lang.String getAlgorithm()
Description copied from interface: java.security.Key
This method returns the name of the algorithm for this key. This is a String such as "RSA".

Specified by:
getAlgorithm in interface java.security.Key

getEncoded

public byte[] getEncoded()
Deprecated. see getEncoded(int).

Description copied from interface: java.security.Key
This method returns the encoded form of the key. If this key does not support encoding, this method returns null.

Specified by:
getEncoded in interface java.security.Key

getFormat

public java.lang.String getFormat()
Description copied from interface: java.security.Key
This method returns the name of the encoding format for this key. This is the name of the ASN.1 data format used for this key, such as "X.509" or "PKCS#8". This method returns null if this key does not have an encoding format.

Specified by:
getFormat in interface java.security.Key

equals

public boolean equals(java.lang.Object obj)

Returns true if the designated object is an instance of java.security.interfaces.DSAKey and has the same DSS (Digital Signature Standard) parameter values as this one.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getEncoded

public abstract byte[] getEncoded(int format)