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 implement AlgorithmParametersSpi that encode parameters using ASN.1.
  • Constructor Details

    • AbstractAlgorithmParametersSpiImpl

      protected AbstractAlgorithmParametersSpiImpl()
      Construct a new instance.
  • Method Details

    • 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 the engineInit method.
      Specified by:
      engineInit in class AlgorithmParametersSpi
      Parameters:
      paramSpec - the parameter specification
      Throws:
      InvalidParameterSpecException - if an argument is invalid or encoding failed
    • engineInit

      protected final void engineInit(byte[] params) throws IOException
      Implementation of the engineInit method.
      Specified by:
      engineInit in class AlgorithmParametersSpi
      Parameters:
      params - the encoded parameter specification
      Throws:
      IOException - if decoding failed
    • engineInit

      protected final void engineInit(byte[] params, String format) throws IOException
      Implementation of the engineInit method.
      Specified by:
      engineInit in class AlgorithmParametersSpi
      Parameters:
      params - the encoded parameter specification
      format - the format (must be ASN.1)
      Throws:
      IOException - if decoding failed or the format is not equal to ASN.1
    • engineEncode

      protected abstract void engineEncode(ASN1Encoder encoder, P parameters) throws ASN1Exception, InvalidParameterSpecException
      Encode a parameter instance.
      Parameters:
      encoder - the encoder to use (not null)
      parameters - the parameter instance (not null)
      Throws:
      ASN1Exception - if there is an encoding problem (usually thrown directly by the ASN1Encoder)
      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 (not null)
      Returns:
      the parameter instance (must not be null)
      Throws:
      ASN1Exception - if there is a decoding problem (usually thrown directly by the ASN1Decoder)
      IOException - if some other decoding error occurred
    • engineGetParameterSpec

      protected final <T extends AlgorithmParameterSpec> T engineGetParameterSpec(Class<T> type) throws InvalidParameterSpecException
      Implementation of the engineGetParameterSpec method.
      Specified by:
      engineGetParameterSpec in class AlgorithmParametersSpi
      Type Parameters:
      T - the parameter specification type
      Parameters:
      type - the parameter specification type class (must not be null)
      Returns:
      the parameter specification (must not be null)
      Throws:
      InvalidParameterSpecException - if the type is not supported
    • engineGetEncoded

      protected final byte[] engineGetEncoded()
      Implementation of the engineGetEncoded method.
      Specified by:
      engineGetEncoded in class AlgorithmParametersSpi
      Returns:
      the encoded representation (not null)
    • engineGetEncoded

      protected final byte[] engineGetEncoded(String format) throws IOException
      Implementation of the engineGetEncoded method.
      Specified by:
      engineGetEncoded in class AlgorithmParametersSpi
      Parameters:
      format - the format string (must not be null)
      Returns:
      the encoded representation (not null)
      Throws:
      IOException - if the given format is not ASN.1
    • engineToString

      protected String engineToString()
      Implementation of the engineToString method.
      Specified by:
      engineToString in class AlgorithmParametersSpi
      Returns:
      the string representation