public class AlgorithmParameters extends Object
AlgorithmParameters
is an engine class which provides algorithm
parameters.Modifier | Constructor and Description |
---|---|
protected |
AlgorithmParameters(AlgorithmParametersSpi algPramSpi,
Provider provider,
String algorithm)
Constructs a new instance of
AlgorithmParameters with the given
arguments. |
Modifier and Type | Method and Description |
---|---|
String |
getAlgorithm()
Returns the name of the algorithm.
|
byte[] |
getEncoded()
Returns this
AlgorithmParameters in their default encoding
format. |
byte[] |
getEncoded(String format)
Returns this
AlgorithmParameters in the specified encoding
format. |
static AlgorithmParameters |
getInstance(String algorithm)
Returns a new instance of
AlgorithmParameters for the specified
algorithm. |
static AlgorithmParameters |
getInstance(String algorithm,
Provider provider)
Returns a new instance of
AlgorithmParameters from the specified
provider for the specified algorithm. |
static AlgorithmParameters |
getInstance(String algorithm,
String provider)
Returns a new instance of
AlgorithmParameters from the specified
provider for the specified algorithm. |
<T extends AlgorithmParameterSpec> |
getParameterSpec(Class<T> paramSpec)
Returns the
AlgorithmParameterSpec for this AlgorithmParameters . |
Provider |
getProvider()
Returns the provider associated with this
AlgorithmParameters . |
void |
init(AlgorithmParameterSpec paramSpec)
Initializes this
AlgorithmParameters with the specified AlgorithmParameterSpec . |
void |
init(byte[] params)
Initializes this
AlgorithmParameters with the specified byte[] using the default decoding format for parameters. |
void |
init(byte[] params,
String format)
Initializes this
AlgorithmParameters with the specified byte[] using the specified decoding format. |
String |
toString()
Returns a string containing a concise, human-readable description of this
AlgorithmParameters . |
protected AlgorithmParameters(AlgorithmParametersSpi algPramSpi, Provider provider, String algorithm)
AlgorithmParameters
with the given
arguments.algPramSpi
- the concrete implementation.provider
- the security provider.algorithm
- the name of the algorithm.public static AlgorithmParameters getInstance(String algorithm) throws NoSuchAlgorithmException
AlgorithmParameters
for the specified
algorithm.algorithm
- the name of the algorithm to use.AlgorithmParameters
for the specified
algorithm.NoSuchAlgorithmException
- if the specified algorithm is not available.NullPointerException
- if algorithm
is null
.public static AlgorithmParameters getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException
AlgorithmParameters
from the specified
provider for the specified algorithm.algorithm
- the name of the algorithm to use.provider
- name of the provider of the AlgorithmParameters
.AlgorithmParameters
for the specified
algorithm.NoSuchAlgorithmException
- if the specified algorithm is not available.NoSuchProviderException
- if the specified provider is not available.IllegalArgumentException
- if provider == null || provider.isEmpty()
NullPointerException
- if algorithm
is null
.public static AlgorithmParameters getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException
AlgorithmParameters
from the specified
provider for the specified algorithm.algorithm
- the name of the algorithm to use.provider
- the provider of the AlgorithmParameters
.AlgorithmParameters
for the specified
algorithm.NoSuchAlgorithmException
- if the specified algorithm is not available.NullPointerException
- if algorithm
is null
.IllegalArgumentException
- if provider == null
public final Provider getProvider()
AlgorithmParameters
.AlgorithmParameters
.public final String getAlgorithm()
public final void init(AlgorithmParameterSpec paramSpec) throws InvalidParameterSpecException
AlgorithmParameters
with the specified AlgorithmParameterSpec
.paramSpec
- the parameter specification.InvalidParameterSpecException
- if this AlgorithmParameters
has already been
initialized or the given paramSpec
is not appropriate
for initializing this AlgorithmParameters
.public final void init(byte[] params) throws IOException
AlgorithmParameters
with the specified byte[]
using the default decoding format for parameters. The default
encoding format is ASN.1.params
- the encoded parameters.IOException
- if this AlgorithmParameters
has already been
initialized, or the parameter could not be encoded.public final void init(byte[] params, String format) throws IOException
AlgorithmParameters
with the specified byte[]
using the specified decoding format.params
- the encoded parameters.format
- the name of the decoding format.IOException
- if this AlgorithmParameters
has already been
initialized, or the parameter could not be encoded.public final <T extends AlgorithmParameterSpec> T getParameterSpec(Class<T> paramSpec) throws InvalidParameterSpecException
AlgorithmParameterSpec
for this AlgorithmParameters
.paramSpec
- the type of the parameter specification in which this
parameters should be converted.AlgorithmParameterSpec
for this AlgorithmParameters
.InvalidParameterSpecException
- if this AlgorithmParameters
has already been
initialized, or if this parameters could not be converted to
the specified class.public final byte[] getEncoded() throws IOException
AlgorithmParameters
in their default encoding
format. The default encoding format is ASN.1.IOException
- if this AlgorithmParameters
has already been
initialized, or if this parameters could not be encoded.public final byte[] getEncoded(String format) throws IOException
AlgorithmParameters
in the specified encoding
format.format
- the name of the encoding format.IOException
- if this AlgorithmParameters
has already been
initialized, or if this parameters could not be encoded.