Final

java.security
Class AlgorithmParameters

java.lang.Object
  extended by java.security.AlgorithmParameters

public class AlgorithmParameters
extends Object

This class provides functionality for dealing with the parameters to the various security algorithms.


Constructor Summary
protected AlgorithmParameters(AlgorithmParametersSpi paramSpi, Provider provider, String algName)
          Constructs a new instance of this class capable of holding the parameter for the specified algorithm.
 
Method Summary
 String getAlgorithm()
          Answers the standard Java security name for the algorithm for which the receiver can hold the arguments.
 byte[] getEncoded()
          Answers the parameters in their primary encoding format.
 byte[] getEncoded(String format)
          Answers the parameters in the specified format.
static AlgorithmParameters getInstance(String algorithmName)
          Answers a new AlgorithmParameters for the algorithm described by the argument.
static AlgorithmParameters getInstance(String algorithm, Provider provider)
          Answers a new AlgorithmParameters which is capable of running the algorithm described by the argument.
static AlgorithmParameters getInstance(String algorithmName, String providerName)
          Answers a new AlgorithmParameters which is capable of running the algorithm described by the argument.
 AlgorithmParameterSpec getParameterSpec(Class paramSpec)
          Answers the parameter specification for the receiver, instantiated from the provided class.
 Provider getProvider()
          Answers the Provider of the algorithm parameters represented by the receiver.
 void init(AlgorithmParameterSpec paramSpec)
          Initializes the receiver with the given parameter specification.
 void init(byte[] params)
          Initializes the receiver with the given parameters which are encoded in the primary format.
 void init(byte[] params, String format)
          Initializes the receiver with the parameters encoded in the given named format.
 String toString()
          Answers a string containing a concise, human-readable description of the receiver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AlgorithmParameters

protected AlgorithmParameters(AlgorithmParametersSpi paramSpi,
                              Provider provider,
                              String algName)
Constructs a new instance of this class capable of holding the parameter for the specified algorithm.

Parameters:
paramSpi - AlgorithmParametersSpi The actual provider-supplied implementation.
provider - Provider The provider of the algorithm parameters.
algName - String Algorithm name.
Method Detail

getAlgorithm

public final String getAlgorithm()
Answers the standard Java security name for the algorithm for which the receiver can hold the arguments.

Returns:
String the name of the algorithm.

getEncoded

public final byte[] getEncoded()
                        throws IOException
Answers the parameters in their primary encoding format.

Returns:
byte[] the parameters in their primary encoding format.
Throws:
IOException - if encoding errors are detected.

getEncoded

public final byte[] getEncoded(String format)
                        throws IOException
Answers the parameters in the specified format. If the specified format is null, return them in the primary format.

Parameters:
format - String The desired encoding format name.
Returns:
byte[] the parameters in the specified encoding format.
Throws:
IOException - if encoding errors are detected

getInstance

public static AlgorithmParameters getInstance(String algorithmName)
                                       throws NoSuchAlgorithmException
Answers a new AlgorithmParameters for the algorithm described by the argument. Throw NoSuchAlgorithmException if no provider provides the named algorithm.

Parameters:
algorithmName - String Name of the desired algorithm.
Returns:
AlgorithmParameters a concrete implementation of a holder for the parameters for the desired algorithm.
Throws:
NoSuchAlgorithmException - If the algorithm cannot be found

getInstance

public static AlgorithmParameters getInstance(String algorithmName,
                                              String providerName)
                                       throws NoSuchAlgorithmException,
                                              NoSuchProviderException
Answers a new AlgorithmParameters which is capable of running the algorithm described by the argument. The result will be an instance of AlgorithmParameters which implements that algorithm.

Parameters:
algorithmName - String Name of the desired algorithm.
providerName - String Name of the provider which has to implement the algorithm.
Returns:
AlgorithmParameters a concrete implementation of a holder for the parameters for the desired algorithm.
Throws:
NoSuchAlgorithmException - If the algorithm cannot be found.
NoSuchProviderException - If the provider cannot be found.

getInstance

public static AlgorithmParameters getInstance(String algorithm,
                                              Provider provider)
                                       throws NoSuchAlgorithmException
Answers a new AlgorithmParameters which is capable of running the algorithm described by the argument. The result will be an instance of AlgorithmParameters which implements that algorithm.

Parameters:
algorithm - String Name of the desired algorithm.
provider - Provider Provider which has to implement the algorithm.
Returns:
AlgorithmParameters a concrete implementation of a holder for the parameters for the desired algorithm.
Throws:
NoSuchAlgorithmException - If the algorithm cannot be found.

getParameterSpec

public final AlgorithmParameterSpec getParameterSpec(Class paramSpec)
                                              throws InvalidParameterSpecException
Answers the parameter specification for the receiver, instantiated from the provided class.

Parameters:
paramSpec - Class Class to use when instantiating the result.
Returns:
AlgorithmParameterSpec the parameter specification for the receiver.
Throws:
InvalidParameterSpecException - if the requested specification is not appropriate for the receiver.

getProvider

public final Provider getProvider()
Answers the Provider of the algorithm parameters represented by the receiver.

Returns:
Provider an instance of a subclass of java.security.Provider.

init

public final void init(byte[] params)
                throws IOException
Initializes the receiver with the given parameters which are encoded in the primary format.

Parameters:
params - byte[] Parameters encoded in the primary format for the receiver.
Throws:
IOException - if decoding errors are detected.

init

public final void init(byte[] params,
                       String format)
                throws IOException
Initializes the receiver with the parameters encoded in the given named format.

Parameters:
params - byte[] Parameters encoded in the named format.
format - String name of the format in which the parameters are encoded.
Throws:
IOException - if decoding errors are detected.

init

public final void init(AlgorithmParameterSpec paramSpec)
                throws InvalidParameterSpecException
Initializes the receiver with the given parameter specification.

Parameters:
paramSpec - AlgorithmParameterSpec The parameter specification to be used.
Throws:
InvalidParameterSpecException - if the provided specification is not appropriate for the receiver.

toString

public final String toString()
Answers a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
a printable representation for the receiver.

Final

Licensed Materials - Property of IBM
© Copyright IBM Corp. 2006, 2008 All Rights Reserved.