Top Description Fields Constructors Methods
org.bouncycastle.crypto.fpe

public abstract Class FPEEngine

extends Object
Class Inheritance
Known Direct Subclasses
org.bouncycastle.crypto.fpe.FPEFF1Engine, org.bouncycastle.crypto.fpe.FPEFF3_1Engine
Imports
org.bouncycastle.crypto.BlockCipher, .CipherParameters, .DataLengthException, .OutputLengthException, org.bouncycastle.crypto.params.FPEParameters, org.bouncycastle.util.Pack

Base class for format-preserving encryption.

Field Summary

Modifier and TypeField and Description
protected final BlockCipher
protected boolean
protected FPEParameters

Constructor Summary

AccessConstructor and Description
protected
FPEEngine(BlockCipher baseCipher)

Method Summary

Modifier and TypeMethod and 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)

public abstract String

Returns:

the name of the algorithm the cipher implements.
getAlgorithmName
()

Return the name of the algorithm the cipher implements.

public abstract void
init(boolean
true if initialising for encryption, false otherwise.
forEncryption
,
CipherParameters
the key and other parameters to use to set the engine up.
parameters
)

Initialize the FPE engine for encryption/decryption.

public int

Returns:

number of bytes output.
processBlock
(byte[]
input data.
inBuf
,
int
offset in input data to start at.
inOff
,
int
number of bytes to process.
length
,
byte[]
destination buffer.
outBuf
,
int
offset to start writing at in destination buffer.
outOff
)

Process length bytes from inBuf, writing the output to outBuf.

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

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseCipherback to summary
protected final BlockCipher baseCipher
forEncryptionback to summary
protected boolean forEncryption
fpeParametersback to summary
protected FPEParameters fpeParameters

Constructor Detail

FPEEngineback to summary
protected FPEEngine(BlockCipher baseCipher)

Method Detail

decryptBlockback to summary
protected abstract int decryptBlock(byte[] inBuf, int inOff, int length, byte[] outBuf, int outOff)
encryptBlockback to summary
protected abstract int encryptBlock(byte[] inBuf, int inOff, int length, byte[] outBuf, int outOff)
getAlgorithmNameback to summary
public abstract String getAlgorithmName()

Return the name of the algorithm the cipher implements.

Returns:String

the name of the algorithm the cipher implements.

initback to summary
public abstract void init(boolean forEncryption, CipherParameters parameters)

Initialize the FPE engine for encryption/decryption.

Parameters
forEncryption:boolean

true if initialising for encryption, false otherwise.

parameters:CipherParameters

the key and other parameters to use to set the engine up.

processBlockback to summary
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:byte[]

input data.

inOff:int

offset in input data to start at.

length:int

number of bytes to process.

outBuf:byte[]

destination buffer.

outOff:int

offset to start writing at in destination buffer.

Returns:int

number of bytes output.

toByteArrayback to summary
protected static byte[] toByteArray(short[] buf)
toShortArrayback to summary
protected static short[] toShortArray(byte[] buf)