public final class AlgIdDSA extends AlgorithmId implements java.security.interfaces.DSAParams
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 follwoing 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);
DSAParams,
DSAPublicKey,
KeyFactory,
DSAPublicKeySpec,
Serialized FormDH_oid, DH_PKIX_oid, DSA_oid, DSA_OIW_oid, EC_oid, MD2_oid, md2WithRSAEncryption_oid, MD5_oid, md5WithRSAEncryption_oid, params, pbeWithMD5AndDES_oid, pbeWithMD5AndRC2_oid, pbeWithSHA1AndDES_oid, pbeWithSHA1AndDESede_oid, pbeWithSHA1AndRC2_40_oid, pbeWithSHA1AndRC2_oid, RSA_oid, RSAEncryption_oid, SHA_oid, sha1WithDSA_oid, sha1WithDSA_OIW_oid, sha1WithECDSA_oid, sha1WithRSAEncryption_oid, sha1WithRSAEncryption_OIW_oid, sha224WithECDSA_oid, SHA256_oid, sha256WithECDSA_oid, sha256WithRSAEncryption_oid, SHA384_oid, sha384WithECDSA_oid, sha384WithRSAEncryption_oid, SHA512_oid, sha512WithECDSA_oid, sha512WithRSAEncryption_oid, shaWithDSA_OIW_oid, specifiedWithECDSA_oid| Constructor and Description |
|---|
AlgIdDSA()
Default constructor.
|
AlgIdDSA(java.math.BigInteger p,
java.math.BigInteger q,
java.math.BigInteger g)
Constructs a DSS/DSA Algorithm ID from numeric parameters.
|
AlgIdDSA(byte[] encodedAlg)
Construct an AlgIdDSA from an X.509 encoded byte array.
|
AlgIdDSA(byte[] p,
byte[] q,
byte[] g)
Constructs a DSS/DSA Algorithm ID from unsigned integers that
define the algorithm parameters.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
decodeParams()
Parses algorithm parameters P, Q, and G.
|
java.math.BigInteger |
getG()
Returns the DSS/DSA parameter "G"
|
java.lang.String |
getName()
Returns "DSA", indicating the Digital Signature Algorithm (DSA) as
defined by the Digital Signature Standard (DSS), FIPS 186.
|
java.math.BigInteger |
getP()
Returns the DSS/DSA parameter "P"
|
java.math.BigInteger |
getQ()
Returns the DSS/DSA parameter "Q"
|
protected java.lang.String |
paramsToString()
Provides a human-readable description of the algorithm parameters.
|
java.lang.String |
toString()
Returns a string describing the algorithm and its parameters.
|
derEncode, encode, encode, equals, equals, equals, get, get, getAlgorithmId, getEncodedParams, getOID, getParameters, hashCode, parsepublic AlgIdDSA()
public AlgIdDSA(byte[] encodedAlg)
throws java.io.IOException
java.io.IOExceptionpublic AlgIdDSA(byte[] p,
byte[] q,
byte[] g)
throws java.io.IOException
p - the DSS/DSA paramter "P"q - the DSS/DSA paramter "Q"g - the DSS/DSA paramter "G"java.io.IOExceptionpublic AlgIdDSA(java.math.BigInteger p,
java.math.BigInteger q,
java.math.BigInteger g)
p - the DSS/DSA paramter "P"q - the DSS/DSA paramter "Q"g - the DSS/DSA paramter "G"public java.math.BigInteger getP()
getP in interface java.security.interfaces.DSAParamspublic java.math.BigInteger getQ()
getQ in interface java.security.interfaces.DSAParamspublic java.math.BigInteger getG()
getG in interface java.security.interfaces.DSAParamspublic java.lang.String getName()
getName in class AlgorithmIdprotected void decodeParams()
throws java.io.IOException
decodeParams in class AlgorithmIdjava.io.IOExceptionpublic java.lang.String toString()
AlgorithmIdtoString in class AlgorithmIdprotected java.lang.String paramsToString()
AlgorithmIdparamsToString in class AlgorithmIdCopyright © 2020. All Rights Reserved.