Class ExemptionMechanismSpi

java.lang.Object
javax.crypto.ExemptionMechanismSpi

public abstract class ExemptionMechanismSpi extends Object
This class defines the Service Provider Interface (SPI) for the ExemptionMechanism class. All the abstract methods in this class must be implemented by each cryptographic service provider who wishes to supply the implementation of a particular exemption mechanism.
Since:
1.4
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for subclasses to call.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract byte[]
    Generates the exemption mechanism key blob.
    protected abstract int
    engineGenExemptionBlob(byte[] output, int outputOffset)
    Generates the exemption mechanism key blob, and stores the result in the output buffer, starting at outputOffset inclusive.
    protected abstract int
    engineGetOutputSize(int inputLen)
    Returns the length in bytes that an output buffer would need to be in order to hold the result of the next engineGenExemptionBlob operation, given the input length inputLen (in bytes).
    protected abstract void
    Initializes this exemption mechanism with a key.
    protected abstract void
    Initializes this exemption mechanism with a key and a set of algorithm parameters.
    protected abstract void
    Initializes this exemption mechanism with a key and a set of algorithm parameters.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Constructor Details

    • ExemptionMechanismSpi

      public ExemptionMechanismSpi()
      Constructor for subclasses to call.
  • Method Details

    • engineGetOutputSize

      protected abstract int engineGetOutputSize(int inputLen)
      Returns the length in bytes that an output buffer would need to be in order to hold the result of the next engineGenExemptionBlob operation, given the input length inputLen (in bytes).

      The actual output length of the next engineGenExemptionBlob call may be smaller than the length returned by this method.

      Parameters:
      inputLen - the input length (in bytes)
      Returns:
      the required output buffer size (in bytes)
    • engineInit

      protected abstract void engineInit(Key key) throws InvalidKeyException, ExemptionMechanismException
      Initializes this exemption mechanism with a key.

      If this exemption mechanism requires any algorithm parameters that cannot be derived from the given key, the underlying exemption mechanism implementation is supposed to generate the required parameters itself (using provider-specific default values); in the case that algorithm parameters must be specified by the caller, an InvalidKeyException is raised.

      Parameters:
      key - the key for this exemption mechanism
      Throws:
      InvalidKeyException - if the given key is inappropriate for this exemption mechanism.
      ExemptionMechanismException - if problem(s) encountered in the process of initializing.
    • engineInit

      Initializes this exemption mechanism with a key and a set of algorithm parameters.

      If this exemption mechanism requires any algorithm parameters and params is null, the underlying exemption mechanism implementation is supposed to generate the required parameters itself (using provider-specific default values); in the case that algorithm parameters must be specified by the caller, an InvalidAlgorithmParameterException is raised.

      Parameters:
      key - the key for this exemption mechanism
      params - the algorithm parameters
      Throws:
      InvalidKeyException - if the given key is inappropriate for this exemption mechanism.
      InvalidAlgorithmParameterException - if the given algorithm parameters are inappropriate for this exemption mechanism.
      ExemptionMechanismException - if problem(s) encountered in the process of initializing.
    • engineInit

      Initializes this exemption mechanism with a key and a set of algorithm parameters.

      If this exemption mechanism requires any algorithm parameters and params is null, the underlying exemption mechanism implementation is supposed to generate the required parameters itself (using provider-specific default values); in the case that algorithm parameters must be specified by the caller, an InvalidAlgorithmParameterException is raised.

      Parameters:
      key - the key for this exemption mechanism
      params - the algorithm parameters
      Throws:
      InvalidKeyException - if the given key is inappropriate for this exemption mechanism.
      InvalidAlgorithmParameterException - if the given algorithm parameters are inappropriate for this exemption mechanism.
      ExemptionMechanismException - if problem(s) encountered in the process of initializing.
    • engineGenExemptionBlob

      protected abstract byte[] engineGenExemptionBlob() throws ExemptionMechanismException
      Generates the exemption mechanism key blob.
      Returns:
      the new buffer with the result key blob.
      Throws:
      ExemptionMechanismException - if problem(s) encountered in the process of generating.
    • engineGenExemptionBlob

      protected abstract int engineGenExemptionBlob(byte[] output, int outputOffset) throws ShortBufferException, ExemptionMechanismException
      Generates the exemption mechanism key blob, and stores the result in the output buffer, starting at outputOffset inclusive.

      If the output buffer is too small to hold the result, a ShortBufferException is thrown. In this case, repeat this call with a larger output buffer. Use engineGetOutputSize to determine how big the output buffer should be.

      Parameters:
      output - the buffer for the result
      outputOffset - the offset in output where the result is stored
      Returns:
      the number of bytes stored in output
      Throws:
      ShortBufferException - if the given output buffer is too small to hold the result.
      ExemptionMechanismException - if problem(s) encountered in the process of generating.