Package org.wildfly.security.util
Class AbstractAlgorithmParametersSpiImpl<P extends AlgorithmParameterSpec>
- java.lang.Object
-
- java.security.AlgorithmParametersSpi
-
- org.wildfly.security.util.AbstractAlgorithmParametersSpiImpl<P>
-
- Type Parameters:
P- the parameter type represented by the subclass
- Direct Known Subclasses:
DigestPasswordAlgorithmParametersSpiImpl,IteratedPasswordAlgorithmParametersSpiImpl,IteratedSaltedPasswordAlgorithmParametersSpiImpl,MaskedPasswordAlgorithmParametersSpiImpl,OneTimePasswordAlgorithmParametersSpiImpl,RSAParameterSpiImpl,SaltedPasswordAlgorithmParametersSpiImpl
public abstract class AbstractAlgorithmParametersSpiImpl<P extends AlgorithmParameterSpec> extends AlgorithmParametersSpi
A base class for classes which implementAlgorithmParametersSpithat encode parameters using ASN.1.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]encodedprivate PparameterSpec
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAlgorithmParametersSpiImpl()Construct a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private voidcheckInit()protected abstract PengineDecode(ASN1Decoder decoder)Decode a parameter instance.protected abstract voidengineEncode(ASN1Encoder encoder, P parameters)Encode a parameter instance.protected byte[]engineGetEncoded()Implementation of theengineGetEncodedmethod.protected byte[]engineGetEncoded(String format)Implementation of theengineGetEncodedmethod.protected <T extends AlgorithmParameterSpec>
TengineGetParameterSpec(Class<T> type)Implementation of theengineGetParameterSpecmethod.protected voidengineInit(byte[] params)Implementation of theengineInitmethod.protected voidengineInit(byte[] params, String format)Implementation of theengineInitmethod.protected voidengineInit(AlgorithmParameterSpec paramSpec)Implementation of theengineInitmethod.protected StringengineToString()Implementation of theengineToStringmethod.protected abstract Class<P>getParameterType()Get the type of parameters for this class.
-
-
-
Field Detail
-
parameterSpec
private P extends AlgorithmParameterSpec parameterSpec
-
encoded
private byte[] encoded
-
-
Method Detail
-
getParameterType
protected abstract Class<P> getParameterType()
Get the type of parameters for this class.- Returns:
- the type of parameters for this class (must not be
null)
-
engineInit
protected final void engineInit(AlgorithmParameterSpec paramSpec) throws InvalidParameterSpecException
Implementation of theengineInitmethod.- Specified by:
engineInitin classAlgorithmParametersSpi- Parameters:
paramSpec- the parameter specification- Throws:
InvalidParameterSpecException- if an argument is invalid or encoding failed
-
engineInit
protected final void engineInit(byte[] params) throws IOExceptionImplementation of theengineInitmethod.- Specified by:
engineInitin classAlgorithmParametersSpi- Parameters:
params- the encoded parameter specification- Throws:
IOException- if decoding failed
-
engineInit
protected final void engineInit(byte[] params, String format) throws IOExceptionImplementation of theengineInitmethod.- Specified by:
engineInitin classAlgorithmParametersSpi- Parameters:
params- the encoded parameter specificationformat- the format (must beASN.1)- Throws:
IOException- if decoding failed or the format is not equal toASN.1
-
engineEncode
protected abstract void engineEncode(ASN1Encoder encoder, P parameters) throws ASN1Exception, InvalidParameterSpecException
Encode a parameter instance.- Parameters:
encoder- the encoder to use (notnull)parameters- the parameter instance (notnull)- Throws:
ASN1Exception- if there is an encoding problem (usually thrown directly by theASN1Encoder)InvalidParameterSpecException- if some other encoding error occurred
-
engineDecode
protected abstract P engineDecode(ASN1Decoder decoder) throws ASN1Exception, IOException
Decode a parameter instance. Subclasses should ensure that all elements are consumed (including sequence terminators and so forth).- Parameters:
decoder- the decoder to use (notnull)- Returns:
- the parameter instance (must not be
null) - Throws:
ASN1Exception- if there is a decoding problem (usually thrown directly by theASN1Decoder)IOException- if some other decoding error occurred
-
engineGetParameterSpec
protected final <T extends AlgorithmParameterSpec> T engineGetParameterSpec(Class<T> type) throws InvalidParameterSpecException
Implementation of theengineGetParameterSpecmethod.- Specified by:
engineGetParameterSpecin classAlgorithmParametersSpi- Type Parameters:
T- the parameter specification type- Parameters:
type- the parameter specification type class (must not benull)- Returns:
- the parameter specification (must not be
null) - Throws:
InvalidParameterSpecException- if the type is not supported
-
engineGetEncoded
protected final byte[] engineGetEncoded()
Implementation of theengineGetEncodedmethod.- Specified by:
engineGetEncodedin classAlgorithmParametersSpi- Returns:
- the encoded representation (not
null)
-
engineGetEncoded
protected final byte[] engineGetEncoded(String format) throws IOException
Implementation of theengineGetEncodedmethod.- Specified by:
engineGetEncodedin classAlgorithmParametersSpi- Parameters:
format- the format string (must not benull)- Returns:
- the encoded representation (not
null) - Throws:
IOException- if the given format is notASN.1
-
checkInit
private void checkInit()
-
engineToString
protected String engineToString()
Implementation of theengineToStringmethod.- Specified by:
engineToStringin classAlgorithmParametersSpi- Returns:
- the string representation
-
-