package aalg.crypto;


/**
 * Implementation of AES (Rijndael) block cipher as described in Fips 197.
 * @author Ing. Petr Ležák
 */
public class AesCipher implements IBlockCipher {

	public static final int BLOCK_LENGTH = Integer.SIZE / Byte.SIZE * AesBase.COLUMN_COUNT;

	public static final int AES_128_KEY_SIZE = 16;
	public static final int AES_192_KEY_SIZE = 24;
	public static final int AES_256_KEY_SIZE = 32;
	
	private final int keySize;
	
	public AesCipher (final int keySize) {
		this.keySize = keySize;
	}
	
	@Override
	public int getBlockLength() {
		return BLOCK_LENGTH;
	}

	@Override
	public AesEncryptor getEncryptor() {
		final AesEncryptor encryptor = new AesEncryptor(this);
		
		return encryptor;
	}

	@Override
	public AesDecryptor getDecryptor() {
		final AesDecryptor decryptor = new AesDecryptor(this);
		
		return decryptor;
	}

	@Override
	public int getKeySize() {
		return keySize;
	}

}
