Algorithm Parameter Specification Interfaces and Classes

An algorithm parameter specification is a transparent representation of the sets of parameters used with an algorithm.

A transparent representation of a set of parameters means that you can access each parameter value in the set individually. You can access these values through one of the get methods defined in the corresponding specification class (for example, DSAParameterSpec defines getP, getQ, and getG methods, to access p, q, and g, respectively).

In contrast, the AlgorithmParameters class supplies an opaque representation, in which you have no direct access to the parameter fields. You can get only the name of the algorithm associated with the parameter set (using getAlgorithm) and some kind of encoding for the parameter set (using getEncoded).

The algorithm parameter specification interfaces and classes in the java.security.spec package are described in the following sections.

The AlgorithmParameterSpec Interface
AlgorithmParameterSpec is an interface to a transparent specification of cryptographic parameters.

This interface contains no methods or constants. Its only purpose is to group (and provide type safety for) all parameter specifications. All parameter specifications must implement this interface.

The DSAParameterSpec Class
This class (which implements the AlgorithmParameterSpec interface) specifies the set of parameters used with the DSA algorithm. It has the following methods:
BigInteger getP()
BigInteger getQ()
BigInteger getG()

These methods return the DSA algorithm parameters: the prime p, the sub-prime q, and the base g.