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.Object
Base class for format-preserving encryption.
Method Summary |
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 |
baseCipher
protected final BlockCipher baseCipher
forEncryption
protected boolean forEncryption
fpeParameters
protected FPEParameters fpeParameters
FPEEngine
protected FPEEngine(BlockCipher baseCipher)
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)