Class AbstractBlockCipherBean

java.lang.Object
org.cryptacular.bean.AbstractCipherBean
org.cryptacular.bean.AbstractBlockCipherBean
All Implemented Interfaces:
CipherBean
Direct Known Subclasses:
AEADBlockCipherBean, BufferedBlockCipherBean

public abstract class AbstractBlockCipherBean extends AbstractCipherBean
Base class for all cipher beans that use block cipher.
Author:
Middleware Services
  • Constructor Details

    • AbstractBlockCipherBean

      public AbstractBlockCipherBean()
      Creates a new instance.
    • AbstractBlockCipherBean

      public AbstractBlockCipherBean(KeyStore keyStore, String keyAlias, String keyPassword, Nonce nonce)
      Creates a new instance by specifying all properties.
      Parameters:
      keyStore - Key store containing encryption key.
      keyAlias - Name of encryption key entry in key store.
      keyPassword - Password used to decrypt key entry in keystore.
      nonce - Nonce/IV generator.
  • Method Details

    • process

      protected byte[] process(CiphertextHeader header, boolean mode, byte[] input)
      Description copied from class: AbstractCipherBean
      Processes the given data under the action of the cipher.
      Specified by:
      process in class AbstractCipherBean
      Parameters:
      header - Ciphertext header.
      mode - True for encryption; false for decryption.
      input - Data to process by cipher.
      Returns:
      Ciphertext data under encryption, plaintext data under decryption.
    • process

      protected void process(CiphertextHeader header, boolean mode, InputStream input, OutputStream output)
      Description copied from class: AbstractCipherBean
      Processes the given data under the action of the cipher.
      Specified by:
      process in class AbstractCipherBean
      Parameters:
      header - Ciphertext header.
      mode - True for encryption; false for decryption.
      input - Stream containing input data.
      output - Stream that receives output of cipher.
    • newCipher

      protected abstract BlockCipherAdapter newCipher(CiphertextHeader header, boolean mode)
      Creates a new cipher adapter instance suitable for the block cipher used by this class.
      Parameters:
      header - Ciphertext header.
      mode - True for encryption; false for decryption.
      Returns:
      Block cipher adapter that wraps an initialized block cipher that is ready for use in the given mode.