Package java.security
Class AlgorithmParameters
java.lang.Object
java.security.AlgorithmParameters
public class AlgorithmParameters extends Object
AlgorithmParameters is an engine class which provides algorithm
parameters.-
Constructor Summary
Constructors Modifier Constructor Description protectedAlgorithmParameters(AlgorithmParametersSpi algPramSpi, Provider provider, String algorithm)Constructs a new instance ofAlgorithmParameterswith the given arguments. -
Method Summary
Modifier and Type Method Description StringgetAlgorithm()Returns the name of the algorithm.byte[]getEncoded()Returns thisAlgorithmParametersin their default encoding format.byte[]getEncoded(String format)Returns thisAlgorithmParametersin the specified encoding format.static AlgorithmParametersgetInstance(String algorithm)Returns a new instance ofAlgorithmParametersfor the specified algorithm.static AlgorithmParametersgetInstance(String algorithm, String provider)Returns a new instance ofAlgorithmParametersfrom the specified provider for the specified algorithm.static AlgorithmParametersgetInstance(String algorithm, Provider provider)Returns a new instance ofAlgorithmParametersfrom the specified provider for the specified algorithm.<T extends AlgorithmParameterSpec>
TgetParameterSpec(Class<T> paramSpec)Returns theAlgorithmParameterSpecfor thisAlgorithmParameters.ProvidergetProvider()Returns the provider associated with thisAlgorithmParameters.voidinit(byte[] params)Initializes thisAlgorithmParameterswith the specifiedbyte[]using the default decoding format for parameters.voidinit(byte[] params, String format)Initializes thisAlgorithmParameterswith the specifiedbyte[]using the specified decoding format.voidinit(AlgorithmParameterSpec paramSpec)Initializes thisAlgorithmParameterswith the specifiedAlgorithmParameterSpec.StringtoString()Returns a string containing a concise, human-readable description of thisAlgorithmParameters.
-
Constructor Details
-
AlgorithmParameters
protected AlgorithmParameters(AlgorithmParametersSpi algPramSpi, Provider provider, String algorithm)Constructs a new instance ofAlgorithmParameterswith the given arguments.- Parameters:
algPramSpi- the concrete implementation.provider- the security provider.algorithm- the name of the algorithm.
-
-
Method Details
-
getInstance
Returns a new instance ofAlgorithmParametersfor the specified algorithm.- Parameters:
algorithm- the name of the algorithm to use.- Returns:
- a new instance of
AlgorithmParametersfor the specified algorithm. - Throws:
NoSuchAlgorithmException- if the specified algorithm is not available.NullPointerException- ifalgorithmisnull.
-
getInstance
public static AlgorithmParameters getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderExceptionReturns a new instance ofAlgorithmParametersfrom the specified provider for the specified algorithm.- Parameters:
algorithm- the name of the algorithm to use.provider- name of the provider of theAlgorithmParameters.- Returns:
- a new instance of
AlgorithmParametersfor the specified algorithm. - Throws:
NoSuchAlgorithmException- if the specified algorithm is not available.NoSuchProviderException- if the specified provider is not available.IllegalArgumentException- ifprovider == null || provider.isEmpty()NullPointerException- ifalgorithmisnull.
-
getInstance
public static AlgorithmParameters getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmExceptionReturns a new instance ofAlgorithmParametersfrom the specified provider for the specified algorithm.- Parameters:
algorithm- the name of the algorithm to use.provider- the provider of theAlgorithmParameters.- Returns:
- a new instance of
AlgorithmParametersfor the specified algorithm. - Throws:
NoSuchAlgorithmException- if the specified algorithm is not available.NullPointerException- ifalgorithmisnull.IllegalArgumentException- ifprovider == null
-
getProvider
Returns the provider associated with thisAlgorithmParameters.- Returns:
- the provider associated with this
AlgorithmParameters.
-
getAlgorithm
Returns the name of the algorithm.- Returns:
- the name of the algorithm.
-
init
Initializes thisAlgorithmParameterswith the specifiedAlgorithmParameterSpec.- Parameters:
paramSpec- the parameter specification.- Throws:
InvalidParameterSpecException- if thisAlgorithmParametershas already been initialized or the givenparamSpecis not appropriate for initializing thisAlgorithmParameters.
-
init
Initializes thisAlgorithmParameterswith the specifiedbyte[]using the default decoding format for parameters. The default encoding format is ASN.1.- Parameters:
params- the encoded parameters.- Throws:
IOException- if thisAlgorithmParametershas already been initialized, or the parameter could not be encoded.
-
init
Initializes thisAlgorithmParameterswith the specifiedbyte[]using the specified decoding format.- Parameters:
params- the encoded parameters.format- the name of the decoding format.- Throws:
IOException- if thisAlgorithmParametershas already been initialized, or the parameter could not be encoded.
-
getParameterSpec
public final <T extends AlgorithmParameterSpec> T getParameterSpec(Class<T> paramSpec) throws InvalidParameterSpecExceptionReturns theAlgorithmParameterSpecfor thisAlgorithmParameters.- Parameters:
paramSpec- the type of the parameter specification in which this parameters should be converted.- Returns:
- the
AlgorithmParameterSpecfor thisAlgorithmParameters. - Throws:
InvalidParameterSpecException- if thisAlgorithmParametershas already been initialized, or if this parameters could not be converted to the specified class.
-
getEncoded
Returns thisAlgorithmParametersin their default encoding format. The default encoding format is ASN.1.- Returns:
- the encoded parameters.
- Throws:
IOException- if thisAlgorithmParametershas already been initialized, or if this parameters could not be encoded.
-
getEncoded
Returns thisAlgorithmParametersin the specified encoding format.- Parameters:
format- the name of the encoding format.- Returns:
- the encoded parameters.
- Throws:
IOException- if thisAlgorithmParametershas already been initialized, or if this parameters could not be encoded.
-
toString
Returns a string containing a concise, human-readable description of thisAlgorithmParameters.
-