Package org.bouncycastle.crypto.fpe
Class FPEEngine
- java.lang.Object
-
- org.bouncycastle.crypto.fpe.FPEEngine
-
- Direct Known Subclasses:
FPEFF1Engine,FPEFF3_1Engine
public abstract class FPEEngine extends java.lang.ObjectBase class for format-preserving encryption.
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockCipherbaseCipherprotected booleanforEncryptionprotected FPEParametersfpeParameters
-
Constructor Summary
Constructors Modifier Constructor Description protectedFPEEngine(BlockCipher baseCipher)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract intdecryptBlock(byte[] inBuf, int inOff, int length, byte[] outBuf, int outOff)protected abstract intencryptBlock(byte[] inBuf, int inOff, int length, byte[] outBuf, int outOff)abstract java.lang.StringgetAlgorithmName()Return the name of the algorithm the cipher implements.abstract voidinit(boolean forEncryption, CipherParameters parameters)Initialize the FPE engine for encryption/decryption.intprocessBlock(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)
-
-
-
Field Detail
-
baseCipher
protected final BlockCipher baseCipher
-
forEncryption
protected boolean forEncryption
-
fpeParameters
protected FPEParameters fpeParameters
-
-
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)
-
-