Note
DSS/DSA Algorithm IDs may be created without these
parameters. Use of DSS/DSA in modes where parameters are
either implicit (e.g. a default applicable to a site or a larger scope),
or are derived from some Certificate Authority's DSS certificate, is
not supported directly. The application is responsible for creating a key
containing the required parameters prior to using the key in cryptographic
operations. The following is an example of how this may be done assuming
that we have a certificate called currentCert which doesn't
contain DSS/DSA parameters and we need to derive DSS/DSA parameters
from a CA's certificate called caCert.
// key containing parameters to use
DSAPublicKey cAKey = (DSAPublicKey)(caCert.getPublicKey());
// key without parameters
DSAPublicKey nullParamsKey = (DSAPublicKey)(currentCert.getPublicKey());
DSAParams cAKeyParams = cAKey.getParams();
KeyFactory kf = KeyFactory.getInstance("DSA");
DSAPublicKeySpec ks = new DSAPublicKeySpec(nullParamsKey.getY(),
cAKeyParams.getP(),
cAKeyParams.getQ(),
cAKeyParams.getG());
DSAPublicKey usableKey = kf.generatePublic(ks);
java.security.interfaces.DSAParams , java.security.interfaces.DSAPublicKey , java.security.KeyFactory , java.security.spec.DSAPublicKeySpec
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private BigInteger | |
| private BigInteger | |
| private BigInteger | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AlgIdDSA(BigInteger
the DSS/DSA parameter "P" p, BigInteger the DSS/DSA parameter "Q" q, BigInteger the DSS/DSA parameter "G" g)Constructs a DSS/DSA Algorithm ID from numeric parameters. |
| Modifier and Type | Method and Description |
|---|---|
| private static byte[] | |
| public BigInteger | |
| public String | getName()
Overrides sun. Returns "DSA", indicating the Digital Signature Algorithm (DSA) as defined by the Digital Signature Standard (DSS), FIPS 186. |
| public BigInteger | |
| public BigInteger | |
| protected String | paramsToString()
Overrides sun. Provides a human-readable description of the algorithm parameters. |
| private void | readObject(ObjectInputStream
the stream)ObjectInputStream from which data is readRestores the state of this object from the stream. |
| public String | toString()
Overrides sun. Returns a string describing the algorithm and its parameters. |
| g | back to summary |
|---|---|
| private BigInteger g | |
| p | back to summary |
|---|---|
| private BigInteger p | |
| q | back to summary |
|---|---|
| private BigInteger q | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides sun. | |
| AlgIdDSA | back to summary |
|---|---|
| public AlgIdDSA()
Deprecated
Default constructor. The OID and parameters must be deserialized before this algorithm ID is used.
| |
| AlgIdDSA | back to summary |
|---|---|
| public AlgIdDSA(BigInteger p, BigInteger q, BigInteger g) Constructs a DSS/DSA Algorithm ID from numeric parameters. If all three are null, then the parameters portion of the algorithm id is set to null. See note in header regarding use.
| |
| encode | back to summary |
|---|---|
| private static byte[] encode(BigInteger p, BigInteger q, BigInteger g) throws IOException | |
| getG | back to summary |
|---|---|
| public BigInteger getG() Implements java. Returns the DSS/DSA parameter "G" | |
| getName | back to summary |
|---|---|
| public String getName() Overrides sun. Returns "DSA", indicating the Digital Signature Algorithm (DSA) as defined by the Digital Signature Standard (DSS), FIPS 186. | |
| getP | back to summary |
|---|---|
| public BigInteger getP() Implements java. Returns the DSS/DSA parameter "P" | |
| getQ | back to summary |
|---|---|
| public BigInteger getQ() Implements java. Returns the DSS/DSA parameter "Q" | |
| paramsToString | back to summary |
|---|---|
| protected String paramsToString() Overrides sun. Doc from sun. Provides a human-readable description of the algorithm parameters. This may be redefined by subclasses which parse those parameters. | |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream stream) throws IOException Restores the state of this object from the stream. Override to check on the 'p', 'q', 'g', and 'encodedParams'.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides sun. Doc from sun. Returns a string describing the algorithm and its parameters. | |
| Modifier and Type | Field and Description |
|---|---|
| private final BigInteger | |
| private final BigInteger | |
| private final BigInteger |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| g | back to summary |
|---|---|
| private final BigInteger g | |
| p | back to summary |
|---|---|
| private final BigInteger p | |
| q | back to summary |
|---|---|
| private final BigInteger q | |
| DSAComponents | back to summary |
|---|---|
| pack-priv DSAComponents(BigInteger p, BigInteger q, BigInteger g) | |