java.lang.Object
org.bouncycastle.crypto.params.ParametersWithContext
All Implemented Interfaces:
CipherParameters

public class ParametersWithContextextends Object implements CipherParameters
Cipher parameters with associated context data. Wraps cipher parameters with additional context information for cryptographic operations.
  • Field Details

    • parameters

      private CipherParameters parameters
      The parameters being wrapped.
    • context

      private byte[] context
      The context bytes mixed into the operation.
  • Constructor Details

    • ParametersWithContext

      public ParametersWithContext(CipherParameters parameters, byte[] context)
      Wrap cipher parameters together with the context bytes they apply to.
      Parameters:
      parameters - the cipher parameters
      context - the context data, which must not be null and is cloned
  • Method Details

    • copyContextTo

      public void copyContextTo(byte[] buf, int off, int len)
      Copy the context bytes into another buffer.
      Parameters:
      buf - the array receiving the copied context bytes
      off - index in buf at which the copy starts
      len - number of context bytes to copy, which must equal the context length
    • getContext

      public byte[] getContext()
      Read the context bytes back.
      Returns:
      a clone of the context bytes the wrapped parameters apply to
    • getContextLength

      public int getContextLength()
      Report how many context bytes are held.
      Returns:
      the number of context bytes held by this object
    • getParameters

      public CipherParameters getParameters()
      Read back the wrapped cipher parameters.
      Returns:
      the cipher parameters this object wraps, as supplied at construction