superwaba.ext.xplat.util.crypto
Class BlowfishCBC

java.lang.Object
  |
  +--superwaba.ext.xplat.util.crypto.BlowfishECB
        |
        +--superwaba.ext.xplat.util.crypto.BlowfishCBC

public class BlowfishCBC
extends BlowfishECB

Implementation of the Blowfish encryption algorithm in CBC mode


Fields inherited from class superwaba.ext.xplat.util.crypto.BlowfishECB
BLOCKSIZE, MAXKEYLENGTH
 
Constructor Summary
BlowfishCBC(byte[] bfkey)
          constructor, stores a zero CBC IV
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
 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 superwaba.ext.xplat.util.crypto.BlowfishECB
decryptBlock, encryptBlock, selfTest
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, toString, wait, wait
 

Constructor Detail

BlowfishCBC

public BlowfishCBC(byte[] bfkey)
constructor, stores a zero CBC IV
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
lInitCBCIV - the CBC IV (array with min. BLOCKSIZE 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 - where to 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)
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
outBuffer - buffer to get the ciphertext data

encrypt

public void encrypt(int[] buffer)
encrypts an integer buffer
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)
Overrides:
decrypt in class BlowfishECB
Parameters:
inbuffer - buffer with ciphertext data
outBuffer - buffer to get the plaintext 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