org.gregoire.util.crypto
Interface BlockCipher

All Known Implementing Classes:
BlowfishECB, Rijndael

public interface BlockCipher

Defines the interface that must be implemented by symmetric block ciphers. This interface is based on work in the Freenet cryptography architecture


Method Summary
 void decrypt(byte[] block, byte[] result)
          Deciphers the contents of block where block must be equal to getBlockSize()/8.
 void encrypt(byte[] block, byte[] result)
          Enciphers the contents of block where block must be equal to getBlockSize()/8.
 int getBlockSize()
          Returns the block size, in bits, of the given block-cipher
 int getKeySize()
          Returns the key size, in bits, of the given block-cipher
 void initialize(byte[] key)
          Initializes the cipher context with the given key.
 

Method Detail

initialize

public void initialize(byte[] key)
Initializes the cipher context with the given key. This might entail performing pre-encryption calculation of subkeys, S-Boxes, etc.


getKeySize

public int getKeySize()
Returns the key size, in bits, of the given block-cipher


getBlockSize

public int getBlockSize()
Returns the block size, in bits, of the given block-cipher


encrypt

public void encrypt(byte[] block,
                    byte[] result)
Enciphers the contents of block where block must be equal to getBlockSize()/8. The result is placed in result and, too has to have length getBlockSize()/8. Block and result may refer to the same array. Warning: It is not a guarantee that block will not be over- written in the course of the algorithm


decrypt

public void decrypt(byte[] block,
                    byte[] result)
Deciphers the contents of block where block must be equal to getBlockSize()/8. The result is placed in result and, too has to have length getBlockSize()/8. Block and result may refer to the same array. Warning: It is not a guarantee that block will not be over- written in the course of the algorithm



Copyright © Paul Gregoire, All Rights Reserved.