All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----Acme.Crypto.CryptoUtils | +----Acme.Crypto.Cipher | +----Acme.Crypto.BlockCipher | +----Acme.Crypto.CbcBlockCipher
A plain old block cipher, key and cleartext-block in, ciphertext-block out, is said to be in Electronic Code Book (ECB) mode. A given block of plaintext always encrypts to the same block of ciphertext. This makes it somewhat vulnerable to known plaintext attacks, block replay attacks, etc.
A fairly cheap alternative is to use it in Cipher Block Chaining (CBC) mode. All this does is XOR each plaintext block with the previous ciphertext block before encryption. For the first block, where there is no previous ciphertext block, a caller-specified Initialization Vector (IV) is used for the XOR. This makes each block's encryption depend on all the previous blocks
This class lets you use any given block cipher in CBC mode.
Fetch the software.
Fetch the entire Acme package.
public CbcBlockCipher(BlockCipher blockCipher)
public void setKey(byte key[])
public void setIv(byte iv[])
public byte[] setRandomIv()
public void encrypt(byte clearText[], int clearOff, byte cipherText[], int cipherOff)
public void decrypt(byte cipherText[], int cipherOff, byte clearText[], int clearOff)
All Packages Class Hierarchy This Package Previous Next Index
ACME Java ACME Labs