Class FPEEngine

java.lang.Object
org.bouncycastle.crypto.fpe.FPEEngine
Direct Known Subclasses:
FPEFF1Engine, FPEFF3_1Engine

public abstract class FPEEngine extends Object
Base class for format-preserving encryption.
  • Field Details

    • baseCipher

      protected final BlockCipher baseCipher
    • forEncryption

      protected boolean forEncryption
    • fpeParameters

      protected FPEParameters fpeParameters
  • Constructor Details

    • FPEEngine

      protected FPEEngine(BlockCipher baseCipher)
  • Method Details

    • processBlock

      public int processBlock(byte[] inBuf, int inOff, int length, byte[] outBuf, int outOff)
      Process length bytes from inBuf, writing the output to outBuf.
      Parameters:
      inBuf - input data.
      inOff - offset in input data to start at.
      length - number of bytes to process.
      outBuf - destination buffer.
      outOff - offset to start writing at in destination buffer.
      Returns:
      number of bytes output.
    • toShortArray

      protected static short[] toShortArray(byte[] buf)
    • toByteArray

      protected static byte[] toByteArray(short[] buf)
    • init

      public abstract void init(boolean forEncryption, CipherParameters parameters)
      Initialize the FPE engine for encryption/decryption.
      Parameters:
      forEncryption - true if initialising for encryption, false otherwise.
      parameters - the key and other parameters to use to set the engine up.
    • getAlgorithmName

      public abstract String getAlgorithmName()
      Return the name of the algorithm the cipher implements.
      Returns:
      the name of the algorithm the cipher implements.
    • encryptBlock

      protected abstract int encryptBlock(byte[] inBuf, int inOff, int length, byte[] outBuf, int outOff)
    • decryptBlock

      protected abstract int decryptBlock(byte[] inBuf, int inOff, int length, byte[] outBuf, int outOff)