public static byte[] encrypt(byte[] keyParam, byte[] dataToEncryptParam, byte[] ivParam) {
        if (dataToEncryptParam == null) {
            throw new FluidClientException("No data to encrypt provided. ",
                    FluidClientException.ErrorCode.AES_256);
        }

        Key key = new SecretKeySpec(keyParam, KEY_ALGO);

        try {
            Cipher cipher = Cipher.getInstance(ALGO_CBC);

            cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(ivParam));

            return cipher.doFinal(dataToEncryptParam);
        }
        //Changed for Java 1.6 compatibility...
        catch (InvalidKeyException except) {
            throw new FluidClientException("Key: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        } catch (InvalidAlgorithmParameterException except) {
            throw new FluidClientException("Algo: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        } catch (IllegalBlockSizeException except) {
            throw new FluidClientException("Block: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        } catch (NoSuchPaddingException except) {
            throw new FluidClientException("NoPadding: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        } catch (NoSuchAlgorithmException except) {
            throw new FluidClientException("NoAlgo: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        } catch (BadPaddingException except) {
            throw new FluidClientException("BadPadding: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        }
    }
public static byte[] encrypt(byte[] keyParam, byte[] dataToEncryptParam, byte[] ivParam) {
        if (dataToEncryptParam == null) {
            throw new FluidClientException("No data to encrypt provided. ",
                    FluidClientException.ErrorCode.AES_256);
        }

        Key key = new SecretKeySpec(keyParam, KEY_ALGO);

        try {
            Cipher cipher = Cipher.getInstance(ALGO_CBC);

            cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(ivParam));

            return cipher.doFinal(dataToEncryptParam);
        }
        
        catch (InvalidKeyException except) {
            throw new FluidClientException("Key: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        } catch (InvalidAlgorithmParameterException except) {
            throw new FluidClientException("Algo: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        } catch (IllegalBlockSizeException except) {
            throw new FluidClientException("Block: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        } catch (NoSuchPaddingException except) {
            throw new FluidClientException("NoPadding: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        } catch (NoSuchAlgorithmException except) {
            throw new FluidClientException("NoAlgo: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        } catch (BadPaddingException except) {
            throw new FluidClientException("BadPadding: Unable to encrypt data. " + except.getMessage(), except,
                    FluidClientException.ErrorCode.AES_256);
        }
    }
public static byte [ ] encrypt ( byte [ ] keyParam , byte [ ] dataToEncryptParam , byte [ ] ivParam ) { if ( dataToEncryptParam == null ) { throw new FluidClientException ( "No data to encrypt provided. " , FluidClientException . ErrorCode . AES_256 ) ; } Key key = new SecretKeySpec ( keyParam , KEY_ALGO ) ; try { Cipher cipher = Cipher . getInstance ( ALGO_CBC ) ; cipher . init ( Cipher . ENCRYPT_MODE , key , new IvParameterSpec ( ivParam ) ) ; return cipher . doFinal ( dataToEncryptParam ) ; } //Changed for Java 1.6 compatibility... catch ( InvalidKeyException except ) { throw new FluidClientException ( "Key: Unable to encrypt data. " + except . getMessage ( ) , except , FluidClientException . ErrorCode . AES_256 ) ; } catch ( InvalidAlgorithmParameterException except ) { throw new FluidClientException ( "Algo: Unable to encrypt data. " + except . getMessage ( ) , except , FluidClientException . ErrorCode . AES_256 ) ; } catch ( IllegalBlockSizeException except ) { throw new FluidClientException ( "Block: Unable to encrypt data. " + except . getMessage ( ) , except , FluidClientException . ErrorCode . AES_256 ) ; } catch ( NoSuchPaddingException except ) { throw new FluidClientException ( "NoPadding: Unable to encrypt data. " + except . getMessage ( ) , except , FluidClientException . ErrorCode . AES_256 ) ; } catch ( NoSuchAlgorithmException except ) { throw new FluidClientException ( "NoAlgo: Unable to encrypt data. " + except . getMessage ( ) , except , FluidClientException . ErrorCode . AES_256 ) ; } catch ( BadPaddingException except ) { throw new FluidClientException ( "BadPadding: Unable to encrypt data. " + except . getMessage ( ) , except , FluidClientException . ErrorCode . AES_256 ) ; } }
Encrypts the {@code dataToEncryptParam} data using key {@code keyParam}.

@param keyParam Key to encrypt with.
@param dataToEncryptParam Data to encrypt.
@param ivParam - 16 bytes for AES-256.
@return Cipher text.
Encrypts the { @code dataToEncryptParam } data using key { @code keyParam } .