Package org.bouncycastle.crypto.fpe
Class FPEEngine
java.lang.Object
org.bouncycastle.crypto.fpe.FPEEngine
- Direct Known Subclasses:
FPEFF1Engine
,FPEFF3_1Engine
Base class for format-preserving encryption.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final BlockCipher
protected boolean
protected FPEParameters
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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 String
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)
-
Field Details
-
baseCipher
-
forEncryption
protected boolean forEncryption -
fpeParameters
-
-
Constructor Details
-
FPEEngine
-
-
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
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
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)
-