Class BufferedBlockCipherSpec

java.lang.Object
org.cryptacular.spec.BufferedBlockCipherSpec
All Implemented Interfaces:
Spec<org.bouncycastle.crypto.BufferedBlockCipher>
Direct Known Subclasses:
KeyedBlockCipherSpec

public class BufferedBlockCipherSpec extends Object implements Spec<org.bouncycastle.crypto.BufferedBlockCipher>
Describes a block cipher in terms of a (algorithm, mode, padding) tuple and provides a facility to create a new instance of the cipher via the newInstance() method.
Version:
$Revision: 2744 $
Author:
Middleware Services
  • Field Details

    • FORMAT

      public static final Pattern FORMAT
      String specification format, algorithm/mode/padding.
  • Constructor Details

    • BufferedBlockCipherSpec

      public BufferedBlockCipherSpec(String algName)
      Creates a new instance from an algorithm name.
      Parameters:
      algName - Cipher algorithm name.
    • BufferedBlockCipherSpec

      public BufferedBlockCipherSpec(String algName, String cipherMode)
      Creates a new instance from a cipher algorithm and mode.
      Parameters:
      algName - Cipher algorithm name.
      cipherMode - Cipher mode.
    • BufferedBlockCipherSpec

      public BufferedBlockCipherSpec(String algName, String cipherMode, String cipherPadding)
      Creates a new instance from the given cipher specifications.
      Parameters:
      algName - Cipher algorithm name.
      cipherMode - Cipher mode.
      cipherPadding - Cipher padding scheme algorithm.
  • Method Details

    • getAlgorithm

      public String getAlgorithm()
      Specified by:
      getAlgorithm in interface Spec<org.bouncycastle.crypto.BufferedBlockCipher>
      Returns:
      Cryptographic algorithm name.
    • getMode

      public String getMode()
      Gets the cipher mode.
      Returns:
      Cipher mode, e.g. CBC, OFB.
    • getPadding

      public String getPadding()
      Gets the cipher padding scheme.
      Returns:
      Padding scheme algorithm, e.g. PKCS5Padding. The following names are equivalent for no padding: NULL, Zero, None.
    • getBlockCipherSpec

      public BlockCipherSpec getBlockCipherSpec()
      Gets the simple block cipher specification corresponding to this instance.
      Returns:
      Simple block cipher specification.
    • newInstance

      public org.bouncycastle.crypto.BufferedBlockCipher newInstance()
      Creates a new buffered block cipher from the specification in this instance.
      Specified by:
      newInstance in interface Spec<org.bouncycastle.crypto.BufferedBlockCipher>
      Returns:
      New buffered block cipher instance.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • parse

      public static BufferedBlockCipherSpec parse(String specification)
      Parses a string representation of a buffered block cipher specification into an instance of this class.
      Parameters:
      specification - Block cipher specification of the form algorithm/mode/padding.
      Returns:
      Buffered block cipher specification instance.