java.security
Class AlgorithmParameters

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.security.AlgorithmParameters

public class AlgorithmParameters
extends Object sample code for java.lang.Object definition code for java.lang.Object

This class is used as an opaque representation of cryptographic parameters.

An AlgorithmParameters object for managing the parameters for a particular algorithm can be obtained by calling one of the getInstance factory methods (static methods that return instances of a given class).

There are two ways to request such an implementation: by specifying either just an algorithm name, or both an algorithm name and a package provider.

Once an AlgorithmParameters object is returned, it must be initialized via a call to init, using an appropriate parameter specification or parameter encoding.

A transparent parameter specification is obtained from an AlgorithmParameters object via a call to getParameterSpec, and a byte encoding of the parameters is obtained via a call to getEncoded.

Since:
1.2
See Also:
AlgorithmParameterSpec sample code for java.security.spec.AlgorithmParameterSpec definition code for java.security.spec.AlgorithmParameterSpec , DSAParameterSpec sample code for java.security.spec.DSAParameterSpec definition code for java.security.spec.DSAParameterSpec , KeyPairGenerator sample code for java.security.KeyPairGenerator definition code for java.security.KeyPairGenerator

Constructor Summary
protected AlgorithmParameters sample code for java.security.AlgorithmParameters.AlgorithmParameters(java.security.AlgorithmParametersSpi, java.security.Provider, java.lang.String) definition code for java.security.AlgorithmParameters.AlgorithmParameters(java.security.AlgorithmParametersSpi, java.security.Provider, java.lang.String) (AlgorithmParametersSpi sample code for java.security.AlgorithmParametersSpi definition code for java.security.AlgorithmParametersSpi  paramSpi, Provider sample code for java.security.Provider definition code for java.security.Provider  provider, String sample code for java.lang.String definition code for java.lang.String  algorithm)
          Creates an AlgorithmParameters object.
 
Method Summary
 String sample code for java.lang.String definition code for java.lang.String getAlgorithm sample code for java.security.AlgorithmParameters.getAlgorithm() definition code for java.security.AlgorithmParameters.getAlgorithm() ()
          Returns the name of the algorithm associated with this parameter object.
 byte[] getEncoded sample code for java.security.AlgorithmParameters.getEncoded() definition code for java.security.AlgorithmParameters.getEncoded() ()
          Returns the parameters in their primary encoding format.
 byte[] getEncoded sample code for java.security.AlgorithmParameters.getEncoded(java.lang.String) definition code for java.security.AlgorithmParameters.getEncoded(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  format)
          Returns the parameters encoded in the specified scheme.
static AlgorithmParameters sample code for java.security.AlgorithmParameters definition code for java.security.AlgorithmParameters getInstance sample code for java.security.AlgorithmParameters.getInstance(java.lang.String) definition code for java.security.AlgorithmParameters.getInstance(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  algorithm)
          Generates a parameter object for the specified algorithm.
static AlgorithmParameters sample code for java.security.AlgorithmParameters definition code for java.security.AlgorithmParameters getInstance sample code for java.security.AlgorithmParameters.getInstance(java.lang.String, java.security.Provider) definition code for java.security.AlgorithmParameters.getInstance(java.lang.String, java.security.Provider) (String sample code for java.lang.String definition code for java.lang.String  algorithm, Provider sample code for java.security.Provider definition code for java.security.Provider  provider)
          Generates a parameter object for the specified algorithm, as supplied by the specified provider, if such an algorithm is available from the provider.
static AlgorithmParameters sample code for java.security.AlgorithmParameters definition code for java.security.AlgorithmParameters getInstance sample code for java.security.AlgorithmParameters.getInstance(java.lang.String, java.lang.String) definition code for java.security.AlgorithmParameters.getInstance(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  algorithm, String sample code for java.lang.String definition code for java.lang.String  provider)
          Generates a parameter object for the specified algorithm, as supplied by the specified provider, if such an algorithm is available from the provider.
<T extends AlgorithmParameterSpec sample code for java.security.spec.AlgorithmParameterSpec definition code for java.security.spec.AlgorithmParameterSpec >
T
getParameterSpec sample code for java.security.AlgorithmParameters.getParameterSpec(java.lang.Class) definition code for java.security.AlgorithmParameters.getParameterSpec(java.lang.Class) (Class sample code for java.lang.Class definition code for java.lang.Class <T> paramSpec)
          Returns a (transparent) specification of this parameter object.
 Provider sample code for java.security.Provider definition code for java.security.Provider getProvider sample code for java.security.AlgorithmParameters.getProvider() definition code for java.security.AlgorithmParameters.getProvider() ()
          Returns the provider of this parameter object.
 void init sample code for java.security.AlgorithmParameters.init(java.security.spec.AlgorithmParameterSpec) definition code for java.security.AlgorithmParameters.init(java.security.spec.AlgorithmParameterSpec) (AlgorithmParameterSpec sample code for java.security.spec.AlgorithmParameterSpec definition code for java.security.spec.AlgorithmParameterSpec  paramSpec)
          Initializes this parameter object using the parameters specified in paramSpec.
 void init sample code for java.security.AlgorithmParameters.init(byte[]) definition code for java.security.AlgorithmParameters.init(byte[]) (byte[] params)
          Imports the specified parameters and decodes them according to the primary decoding format for parameters.
 void init sample code for java.security.AlgorithmParameters.init(byte[], java.lang.String) definition code for java.security.AlgorithmParameters.init(byte[], java.lang.String) (byte[] params, String sample code for java.lang.String definition code for java.lang.String  format)
          Imports the parameters from params and decodes them according to the specified decoding scheme.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.security.AlgorithmParameters.toString() definition code for java.security.AlgorithmParameters.toString() ()
          Returns a formatted string describing the parameters.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

AlgorithmParameters sample code for java.security.AlgorithmParameters(java.security.AlgorithmParametersSpi, java.security.Provider, java.lang.String) definition code for java.security.AlgorithmParameters(java.security.AlgorithmParametersSpi, java.security.Provider, java.lang.String)

protected AlgorithmParameters(AlgorithmParametersSpi sample code for java.security.AlgorithmParametersSpi definition code for java.security.AlgorithmParametersSpi  paramSpi,
                              Provider sample code for java.security.Provider definition code for java.security.Provider  provider,
                              String sample code for java.lang.String definition code for java.lang.String  algorithm)
Creates an AlgorithmParameters object.

Parameters:
paramSpi - the delegate
provider - the provider
algorithm - the algorithm
Method Detail

getAlgorithm sample code for java.security.AlgorithmParameters.getAlgorithm() definition code for java.security.AlgorithmParameters.getAlgorithm()

public final String sample code for java.lang.String definition code for java.lang.String  getAlgorithm()
Returns the name of the algorithm associated with this parameter object.

Returns:
the algorithm name.

getInstance sample code for java.security.AlgorithmParameters.getInstance(java.lang.String) definition code for java.security.AlgorithmParameters.getInstance(java.lang.String)

public static AlgorithmParameters sample code for java.security.AlgorithmParameters definition code for java.security.AlgorithmParameters  getInstance(String sample code for java.lang.String definition code for java.lang.String  algorithm)
                                       throws NoSuchAlgorithmException sample code for java.security.NoSuchAlgorithmException definition code for java.security.NoSuchAlgorithmException 
Generates a parameter object for the specified algorithm.

If the default provider package provides an implementation of the requested algorithm, an instance of AlgorithmParameters containing that implementation is returned. If the algorithm is not available in the default package, other packages are searched.

The returned parameter object must be initialized via a call to init, using an appropriate parameter specification or parameter encoding.

Parameters:
algorithm - the name of the algorithm requested.
Returns:
the new parameter object.
Throws:
NoSuchAlgorithmException sample code for java.security.NoSuchAlgorithmException definition code for java.security.NoSuchAlgorithmException - if the algorithm is not available in the environment.

getInstance sample code for java.security.AlgorithmParameters.getInstance(java.lang.String, java.lang.String) definition code for java.security.AlgorithmParameters.getInstance(java.lang.String, java.lang.String)

public static AlgorithmParameters sample code for java.security.AlgorithmParameters definition code for java.security.AlgorithmParameters  getInstance(String sample code for java.lang.String definition code for java.lang.String  algorithm,
                                              String sample code for java.lang.String definition code for java.lang.String  provider)
                                       throws NoSuchAlgorithmException sample code for java.security.NoSuchAlgorithmException definition code for java.security.NoSuchAlgorithmException ,
                                              NoSuchProviderException sample code for java.security.NoSuchProviderException definition code for java.security.NoSuchProviderException 
Generates a parameter object for the specified algorithm, as supplied by the specified provider, if such an algorithm is available from the provider.

The returned parameter object must be initialized via a call to init, using an appropriate parameter specification or parameter encoding.

Parameters:
algorithm - the name of the algorithm requested.
provider - the name of the provider.
Returns:
the new parameter object.
Throws:
NoSuchAlgorithmException sample code for java.security.NoSuchAlgorithmException definition code for java.security.NoSuchAlgorithmException - if the algorithm is not available in the package supplied by the requested provider.
NoSuchProviderException sample code for java.security.NoSuchProviderException definition code for java.security.NoSuchProviderException - if the provider is not available in the environment.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the provider name is null or empty.
See Also:
Provider sample code for java.security.Provider definition code for java.security.Provider

getInstance sample code for java.security.AlgorithmParameters.getInstance(java.lang.String, java.security.Provider) definition code for java.security.AlgorithmParameters.getInstance(java.lang.String, java.security.Provider)

public static AlgorithmParameters sample code for java.security.AlgorithmParameters definition code for java.security.AlgorithmParameters  getInstance(String sample code for java.lang.String definition code for java.lang.String  algorithm,
                                              Provider sample code for java.security.Provider definition code for java.security.Provider  provider)
                                       throws NoSuchAlgorithmException sample code for java.security.NoSuchAlgorithmException definition code for java.security.NoSuchAlgorithmException 
Generates a parameter object for the specified algorithm, as supplied by the specified provider, if such an algorithm is available from the provider. Note: the provider doesn't have to be registered.

The returned parameter object must be initialized via a call to init, using an appropriate parameter specification or parameter encoding.

Parameters:
algorithm - the name of the algorithm requested.
provider - the name of the provider.
Returns:
the new parameter object.
Throws:
NoSuchAlgorithmException sample code for java.security.NoSuchAlgorithmException definition code for java.security.NoSuchAlgorithmException - if the algorithm is not available in the package supplied by the requested provider.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the provider is null.
Since:
1.4
See Also:
Provider sample code for java.security.Provider definition code for java.security.Provider

getProvider sample code for java.security.AlgorithmParameters.getProvider() definition code for java.security.AlgorithmParameters.getProvider()

public final Provider sample code for java.security.Provider definition code for java.security.Provider  getProvider()
Returns the provider of this parameter object.

Returns:
the provider of this parameter object

init sample code for java.security.AlgorithmParameters.init(java.security.spec.AlgorithmParameterSpec) definition code for java.security.AlgorithmParameters.init(java.security.spec.AlgorithmParameterSpec)

public final void init(AlgorithmParameterSpec sample code for java.security.spec.AlgorithmParameterSpec definition code for java.security.spec.AlgorithmParameterSpec  paramSpec)
                throws InvalidParameterSpecException sample code for java.security.spec.InvalidParameterSpecException definition code for java.security.spec.InvalidParameterSpecException 
Initializes this parameter object using the parameters specified in paramSpec.

Parameters:
paramSpec - the parameter specification.
Throws:
InvalidParameterSpecException sample code for java.security.spec.InvalidParameterSpecException definition code for java.security.spec.InvalidParameterSpecException - if the given parameter specification is inappropriate for the initialization of this parameter object, or if this parameter object has already been initialized.

init sample code for java.security.AlgorithmParameters.init(byte[]) definition code for java.security.AlgorithmParameters.init(byte[])

public final void init(byte[] params)
                throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Imports the specified parameters and decodes them according to the primary decoding format for parameters. The primary decoding format for parameters is ASN.1, if an ASN.1 specification for this type of parameters exists.

Parameters:
params - the encoded parameters.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - on decoding errors, or if this parameter object has already been initialized.

init sample code for java.security.AlgorithmParameters.init(byte[], java.lang.String) definition code for java.security.AlgorithmParameters.init(byte[], java.lang.String)

public final void init(byte[] params,
                       String sample code for java.lang.String definition code for java.lang.String  format)
                throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Imports the parameters from params and decodes them according to the specified decoding scheme. If format is null, the primary decoding format for parameters is used. The primary decoding format is ASN.1, if an ASN.1 specification for these parameters exists.

Parameters:
params - the encoded parameters.
format - the name of the decoding scheme.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - on decoding errors, or if this parameter object has already been initialized.

getParameterSpec sample code for java.security.AlgorithmParameters.<T extends java.security.spec.AlgorithmParameterSpec>getParameterSpec(java.lang.Class<T>) definition code for java.security.AlgorithmParameters.<T extends java.security.spec.AlgorithmParameterSpec>getParameterSpec(java.lang.Class<T>)

public final <T extends AlgorithmParameterSpec sample code for java.security.spec.AlgorithmParameterSpec definition code for java.security.spec.AlgorithmParameterSpec > T getParameterSpec(Class sample code for java.lang.Class definition code for java.lang.Class <T> paramSpec)
                                                        throws InvalidParameterSpecException sample code for java.security.spec.InvalidParameterSpecException definition code for java.security.spec.InvalidParameterSpecException 
Returns a (transparent) specification of this parameter object. paramSpec identifies the specification class in which the parameters should be returned. It could, for example, be DSAParameterSpec.class, to indicate that the parameters should be returned in an instance of the DSAParameterSpec class.

Parameters:
paramSpec - the specification class in which the parameters should be returned.
Returns:
the parameter specification.
Throws:
InvalidParameterSpecException sample code for java.security.spec.InvalidParameterSpecException definition code for java.security.spec.InvalidParameterSpecException - if the requested parameter specification is inappropriate for this parameter object, or if this parameter object has not been initialized.

getEncoded sample code for java.security.AlgorithmParameters.getEncoded() definition code for java.security.AlgorithmParameters.getEncoded()

public final byte[] getEncoded()
                        throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Returns the parameters in their primary encoding format. The primary encoding format for parameters is ASN.1, if an ASN.1 specification for this type of parameters exists.

Returns:
the parameters encoded using their primary encoding format.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - on encoding errors, or if this parameter object has not been initialized.

getEncoded sample code for java.security.AlgorithmParameters.getEncoded(java.lang.String) definition code for java.security.AlgorithmParameters.getEncoded(java.lang.String)

public final byte[] getEncoded(String sample code for java.lang.String definition code for java.lang.String  format)
                        throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Returns the parameters encoded in the specified scheme. If format is null, the primary encoding format for parameters is used. The primary encoding format is ASN.1, if an ASN.1 specification for these parameters exists.

Parameters:
format - the name of the encoding format.
Returns:
the parameters encoded using the specified encoding scheme.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - on encoding errors, or if this parameter object has not been initialized.

toString sample code for java.security.AlgorithmParameters.toString() definition code for java.security.AlgorithmParameters.toString()

public final String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a formatted string describing the parameters.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a formatted string describing the parameters, or null if this parameter object has not been initialized.