Package java.security
Class AlgorithmParameters
- java.lang.Object
-
- java.security.AlgorithmParameters
-
public class AlgorithmParameters extends Object
AlgorithmParametersis 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
All Methods Static Methods Instance Methods Concrete Methods 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 Detail
-
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 Detail
-
getInstance
public static AlgorithmParameters getInstance(String algorithm) throws NoSuchAlgorithmException
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, NoSuchProviderException
Returns 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 NoSuchAlgorithmException
Returns a new instance ofAlgorithmParametersfrom the specified provider for the specified algorithm. Theprovidersupplied does not have to be registered.- 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
public final Provider getProvider()
Returns the provider associated with thisAlgorithmParameters.- Returns:
- the provider associated with this
AlgorithmParameters.
-
getAlgorithm
public final String getAlgorithm()
Returns the name of the algorithm.- Returns:
- the name of the algorithm.
-
init
public final void init(AlgorithmParameterSpec paramSpec) throws InvalidParameterSpecException
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
public final void init(byte[] params) throws IOExceptionInitializes 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
public final void init(byte[] params, String format) throws IOExceptionInitializes 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 InvalidParameterSpecException
Returns 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
public final byte[] getEncoded() throws IOExceptionReturns 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
public final byte[] getEncoded(String format) throws IOException
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.
-
-