Class FPEEngine

  • Direct Known Subclasses:
    FPEFF1Engine, FPEFF3_1Engine

    public abstract class FPEEngine
    extends java.lang.Object
    Base class for format-preserving encryption.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected FPEEngine​(BlockCipher baseCipher)  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract int decryptBlock​(byte[] inBuf, int inOff, int length, byte[] outBuf, int outOff)  
      protected abstract int encryptBlock​(byte[] inBuf, int inOff, int length, byte[] outBuf, int outOff)  
      abstract java.lang.String getAlgorithmName()
      Return the name of the algorithm the cipher implements.
      abstract void init​(boolean forEncryption, CipherParameters parameters)
      Initialize the FPE engine for encryption/decryption.
      int processBlock​(byte[] inBuf, int inOff, int length, byte[] outBuf, int outOff)
      Process length bytes from inBuf, writing the output to outBuf.
      protected static byte[] toByteArray​(short[] buf)  
      protected static short[] toShortArray​(byte[] buf)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • forEncryption

        protected boolean forEncryption
    • Constructor Detail

      • FPEEngine

        protected FPEEngine​(BlockCipher baseCipher)
    • Method Detail

      • 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 java.lang.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)