org.gregoire.util.crypto
Class BlowfishCBC

java.lang.Object
  extended byorg.gregoire.util.crypto.BlowfishECB
      extended byorg.gregoire.util.crypto.BlowfishCBC
All Implemented Interfaces:
BlockCipher

public class BlowfishCBC
extends BlowfishECB

implementation of the Blowfish encryption algorithm in CBC mode

Version:
August 10, 2001
Author:
Markus Hahn

Field Summary
 
Fields inherited from class org.gregoire.util.crypto.BlowfishECB
BLOCKSIZE, MAXKEYLENGTH
 
Constructor Summary
BlowfishCBC()
          constructor, stores a zero CBC IV
BlowfishCBC(byte[] bfkey)
           
BlowfishCBC(byte[] bfkey, byte[] initCBCIV)
          constructor
BlowfishCBC(byte[] bfkey, long lInitCBCIV)
          constructor
 
Method Summary
 void cleanUp()
          cleans up all critical internals, call this if you don't need an instance anymore
 void decrypt(byte[] buffer)
          decrypts a byte buffer (should be aligned to an 8 byte border) to itself
 void decrypt(byte[] inbuffer, byte[] outbuffer)
          decrypts a byte buffer (should be aligned to an 8 byte border) to another buffer (of the same size or bigger)
 void decrypt(int[] buffer)
          decrypts an int buffer (should be aligned to a two integer border)
 void decrypt(int[] inbuffer, int[] outbuffer)
          decrypts an integer buffer (should be aligned to an two integer border) to another int buffer (of the same size or bigger)
 void decrypt(long[] buffer)
          decrypts a long buffer to itself
 void decrypt(long[] inbuffer, long[] outbuffer)
          decrypts a long buffer to another long buffer (of the same size or bigger)
 void encrypt(byte[] buffer)
          encrypts a byte buffer (should be aligned to an 8 byte border) to itself
 void encrypt(byte[] inbuffer, byte[] outbuffer)
          encrypts a byte buffer (should be aligned to an 8 byte border) to another buffer (of the same size or bigger)
 void encrypt(int[] buffer)
          encrypts an integer buffer (should be aligned to an
 void encrypt(int[] inbuffer, int[] outbuffer)
          encrypts an int buffer (should be aligned to an two integer border) to another int buffer (of the same size or bigger)
 void encrypt(long[] buffer)
          encrypts a long buffer to itself
 void encrypt(long[] inbuffer, long[] outbuffer)
          encrypts a long buffer to another long buffer (of the same size or bigger)
 long getCBCIV()
          get the current CBC IV (for cipher resets)
 void getCBCIV(byte[] dest)
          get the current CBC IV (for cipher resets)
 void setCBCIV(byte[] newCBCIV)
          set the current CBC IV (for cipher resets)
 void setCBCIV(long lNewCBCIV)
          set the current CBC IV (for cipher resets)
 
Methods inherited from class org.gregoire.util.crypto.BlowfishECB
decryptBlock, encryptBlock, getBlockSize, getKeySize, initialize, weakKeyCheck
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlowfishCBC

public BlowfishCBC()
constructor, stores a zero CBC IV


BlowfishCBC

public BlowfishCBC(byte[] bfkey)
Parameters:
bfkey - key material, up to MAXKEYLENGTH bytes

BlowfishCBC

public BlowfishCBC(byte[] bfkey,
                   long lInitCBCIV)
constructor

Parameters:
bfkey - key material, up to MAXKEYLENGTH bytes
lInitCBCIV - the CBC IV

BlowfishCBC

public BlowfishCBC(byte[] bfkey,
                   byte[] initCBCIV)
constructor

Parameters:
bfkey - key material, up to MAXKEYLENGTH bytes
Method Detail

getCBCIV

public long getCBCIV()
get the current CBC IV (for cipher resets)

Returns:
current CBC IV

getCBCIV

public void getCBCIV(byte[] dest)
get the current CBC IV (for cipher resets)

Parameters:
dest - wher eto put current CBC IV in network byte ordered array

setCBCIV

public void setCBCIV(long lNewCBCIV)
set the current CBC IV (for cipher resets)

Parameters:
lNewCBCIV - the new CBC IV

setCBCIV

public void setCBCIV(byte[] newCBCIV)
set the current CBC IV (for cipher resets)

Parameters:
newCBCIV - the new CBC IV in network byte ordered array

cleanUp

public void cleanUp()
cleans up all critical internals, call this if you don't need an instance anymore

Overrides:
cleanUp in class BlowfishECB

encrypt

public void encrypt(byte[] inbuffer,
                    byte[] outbuffer)
encrypts a byte buffer (should be aligned to an 8 byte border) to another buffer (of the same size or bigger)

Specified by:
encrypt in interface BlockCipher
Overrides:
encrypt in class BlowfishECB
Parameters:
inbuffer - buffer with plaintext data
outbuffer - buffer to get the ciphertext data

encrypt

public void encrypt(byte[] buffer)
encrypts a byte buffer (should be aligned to an 8 byte border) to itself

Overrides:
encrypt in class BlowfishECB
Parameters:
buffer - buffer to encrypt

encrypt

public void encrypt(int[] inbuffer,
                    int[] outbuffer)
encrypts an int buffer (should be aligned to an two integer border) to another int buffer (of the same size or bigger)

Overrides:
encrypt in class BlowfishECB
Parameters:
inbuffer - buffer with plaintext data

encrypt

public void encrypt(int[] buffer)
encrypts an integer buffer (should be aligned to an

Overrides:
encrypt in class BlowfishECB
Parameters:
buffer - buffer to encrypt

encrypt

public void encrypt(long[] inbuffer,
                    long[] outbuffer)
encrypts a long buffer to another long buffer (of the same size or bigger)

Overrides:
encrypt in class BlowfishECB
Parameters:
inbuffer - buffer with plaintext data
outbuffer - buffer to get the ciphertext data

encrypt

public void encrypt(long[] buffer)
encrypts a long buffer to itself

Overrides:
encrypt in class BlowfishECB
Parameters:
buffer - buffer to encrypt

decrypt

public void decrypt(byte[] inbuffer,
                    byte[] outbuffer)
decrypts a byte buffer (should be aligned to an 8 byte border) to another buffer (of the same size or bigger)

Specified by:
decrypt in interface BlockCipher
Overrides:
decrypt in class BlowfishECB
Parameters:
inbuffer - buffer with ciphertext data

decrypt

public void decrypt(byte[] buffer)
decrypts a byte buffer (should be aligned to an 8 byte border) to itself

Overrides:
decrypt in class BlowfishECB
Parameters:
buffer - buffer to decrypt

decrypt

public void decrypt(int[] inbuffer,
                    int[] outbuffer)
decrypts an integer buffer (should be aligned to an two integer border) to another int buffer (of the same size or bigger)

Overrides:
decrypt in class BlowfishECB
Parameters:
inbuffer - buffer with ciphertext data
outbuffer - buffer to get the plaintext data

decrypt

public void decrypt(int[] buffer)
decrypts an int buffer (should be aligned to a two integer border)

Overrides:
decrypt in class BlowfishECB
Parameters:
buffer - buffer to decrypt

decrypt

public void decrypt(long[] inbuffer,
                    long[] outbuffer)
decrypts a long buffer to another long buffer (of the same size or bigger)

Overrides:
decrypt in class BlowfishECB
Parameters:
inbuffer - buffer with ciphertext data
outbuffer - buffer to get the plaintext data

decrypt

public void decrypt(long[] buffer)
decrypts a long buffer to itself

Overrides:
decrypt in class BlowfishECB
Parameters:
buffer - buffer to decrypt


Copyright © Paul Gregoire, All Rights Reserved.