public class BlowfishCBC extends BlowfishECB
BLOCKSIZE, MAXKEYLENGTH
Constructor and Description |
---|
BlowfishCBC(byte[] key)
Default constructor, uses a zero CBC IV.
|
BlowfishCBC(byte[] key,
byte[] initCBCIV)
Deprecated.
use BlowfishCBC(byte[], int, int, byte[], int) instead
|
BlowfishCBC(byte[] key,
int nOfs,
int nLen)
Constructor, uses a zero CBC IV.
|
BlowfishCBC(byte[] key,
int nOfs,
int nLen,
byte[] initCBCIV,
int nIVOfs)
Constructor to define the CBC IV.
|
BlowfishCBC(byte[] key,
int nOfs,
int nLen,
long lInitCBCIV)
Constructor to define the CBC IV.
|
BlowfishCBC(byte[] key,
long lInitCBCIV)
Deprecated.
use BlowfishCBC(byte[], int, int, long) instead
|
Modifier and Type | Method and Description |
---|---|
void |
cleanUp()
see BlowfishJ.BlowfishECB#cleanUp()
|
int |
decrypt(byte[] inBuf,
int nInPos,
byte[] outBuf,
int nOutPos,
int nLen)
Decrypts a byte buffer to another buffer, extra misaligned data
will not be processed.
|
int |
encrypt(byte[] inBuf,
int nInPos,
byte[] outBuf,
int nOutPos,
int nLen)
Encrypts a byte buffer to another buffer, extra misaligned data
will not be processed.
|
long |
getCBCIV()
Gets the current CBC IV.
|
void |
getCBCIV(byte[] dest)
Deprecated.
use getCBCIV(byte[], int) instead
|
void |
getCBCIV(byte[] dest,
int nOfs)
Gets a copy of the current CBC IV.
|
void |
reset(byte[] key,
int offset,
int length)
Reset the Encryptor/Decryptor using a specific key.
|
void |
setCBCIV(byte[] newCBCIV)
Deprecated.
use setCBCIV(byte[], int) instead
|
void |
setCBCIV(byte[] newCBCIV,
int nOfs)
Sets the current CBC IV (for cipher resets).
|
void |
setCBCIV(long lNewCBCIV)
Sets the current CBC IV (for cipher resets).
|
byteArrayToInt, encryptPrv, initialize, reset, weakKeyCheck
public BlowfishCBC(byte[] key)
key
- key material, up to MAXKEYLENGTH bytespublic BlowfishCBC(byte[] key, int nOfs, int nLen)
key
- key material, up to MAXKEYLENGTH bytesnOfs
- where to start reading the keynLen
- size of the key in bytespublic BlowfishCBC(byte[] key, long lInitCBCIV)
key
- key material, up to MAXKEYLENGTH byteslInitCBCIV
- the CBC IVpublic BlowfishCBC(byte[] key, int nOfs, int nLen, long lInitCBCIV)
key
- key material, up to MAXKEYLENGTH bytesnOfs
- where to start reading the keynLen
- size of the key in byteslInitCBCIV
- the CBC IVpublic BlowfishCBC(byte[] key, byte[] initCBCIV)
key
- key material, up to MAXKEYLENGTH bytesinitCBCIV
- the CBC IV (array with BLOCKSIZE bytes)public BlowfishCBC(byte[] key, int nOfs, int nLen, byte[] initCBCIV, int nIVOfs)
key
- key material, up to MAXKEYLENGTH bytesnOfs
- where to start reading the keynLen
- size of the key in bytesinitCBCIV
- the CBC IVnIVOfs
- where to start reading the IVpublic long getCBCIV()
public void getCBCIV(byte[] dest)
dest
- where to put current CBC IVpublic void getCBCIV(byte[] dest, int nOfs)
dest
- buffernOfs
- where to start writingpublic void setCBCIV(long lNewCBCIV)
lNewCBCIV
- the new CBC IVpublic void setCBCIV(byte[] newCBCIV)
newCBCIV
- the new CBC IVpublic void setCBCIV(byte[] newCBCIV, int nOfs)
newCBCIV
- the new CBC IVnOfs
- where to start reading the IVpublic void reset(byte[] key, int offset, int length)
BlowfishECB
reset
in class BlowfishECB
public void cleanUp()
cleanUp
in class BlowfishECB
public int encrypt(byte[] inBuf, int nInPos, byte[] outBuf, int nOutPos, int nLen)
BlowfishECB
encrypt
in class BlowfishECB
inBuf
- buffer with plaintext datanInPos
- where to start reading the plaintext dataoutBuf
- buffer to put the ciphertext datanOutPos
- where to start writing the ciphertext datanLen
- number of bytes to encryptBlowfishJ.BlowfishECB#encrypt(byte[], int, byte[], int, int)
public int decrypt(byte[] inBuf, int nInPos, byte[] outBuf, int nOutPos, int nLen)
BlowfishECB
decrypt
in class BlowfishECB
inBuf
- buffer with ciphertext datanInPos
- where to start reading the ciphertext dataoutBuf
- buffer to put the plaintext datanOutPos
- where to start writing the plaintext datanLen
- number of bytes to decryptBlowfishJ.BlowfishECB#decrypt(byte[], int, byte[], int, int)