memetic.crypto
Interface Crypt

All Known Implementing Classes:
AESCrypt, DESCrypt

public interface Crypt

Version:
1-1-alpha3
Author:
Andrew G D Rowley

Method Summary
 int decrypt(byte[] input, int offset, int length, byte[] output, int outOffset)
          Decrypts the input
 int encrypt(byte[] input, int offset, int length, byte[] output, int outOffset)
          Encrypts the input
 int getBlockSize()
          Returns the size of the block of the encryption or decryption
 int getDecryptOutputSize(int inputSize)
          Returns the maximum size the output buffer needs to be
 int getEncryptOutputSize(int inputSize)
          Returns the maximum size the output buffer needs to be
 

Method Detail

encrypt

int encrypt(byte[] input,
            int offset,
            int length,
            byte[] output,
            int outOffset)
            throws javax.crypto.ShortBufferException,
                   javax.crypto.IllegalBlockSizeException,
                   javax.crypto.BadPaddingException,
                   java.security.InvalidKeyException,
                   java.security.InvalidAlgorithmParameterException
Encrypts the input

Parameters:
input - The input to be encrypted
offset - The offset into the input buffer where the input starts
length - The length of the input
output - The output buffer
outOffset - The offset into the output buffer where to store the output
Returns:
The length of the output stored in the output buffer
Throws:
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
javax.crypto.ShortBufferException
java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyException

decrypt

int decrypt(byte[] input,
            int offset,
            int length,
            byte[] output,
            int outOffset)
            throws javax.crypto.ShortBufferException,
                   javax.crypto.IllegalBlockSizeException,
                   javax.crypto.BadPaddingException,
                   java.security.InvalidKeyException,
                   java.security.InvalidAlgorithmParameterException
Decrypts the input

Parameters:
input - The input to be decrypted
offset - The offset into the input buffer where the input starts
length - The length of the input
output - The output buffer
outOffset - The offset into the output buffer where to store the output
Returns:
The length of the output stored in the output buffer
Throws:
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
javax.crypto.ShortBufferException
java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyException

getEncryptOutputSize

int getEncryptOutputSize(int inputSize)
Returns the maximum size the output buffer needs to be

Parameters:
inputSize - The size of the input to be encrypted
Returns:
The maximum size of the output buffer
Throws:
java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyException

getDecryptOutputSize

int getDecryptOutputSize(int inputSize)
Returns the maximum size the output buffer needs to be

Parameters:
inputSize - The size of the input to be decrypted
Returns:
The maximum size of the output buffer

getBlockSize

int getBlockSize()
Returns the size of the block of the encryption or decryption

Returns:
The block size (in bytes)