code: public byte[] encrypt(byte[] key, byte[] initializationVector, byte[] message) {
  		try {
  			IvParameterSpec initializationVectorSpec = new IvParameterSpec(initializationVector);
  			final SecretKeySpec skey = new SecretKeySpec(key, keyAlgorithm);
  			final Cipher cipher = (((provider == null) || (provider.length() == 0))
  					? Cipher.getInstance(cipherAlgorithm)
  					: Cipher.getInstance(cipherAlgorithm, provider));
  			switch (mode) {
  				case ENCRYPT:
  					cipher.init(Cipher.ENCRYPT_MODE, skey, initializationVectorSpec);
  					break;
  				case DECRYPT:
  					cipher.init(Cipher.DECRYPT_MODE, skey, initializationVectorSpec);
  					break;
  				default:
  					throw new SymmetricEncryptionException("error encrypting/decrypting message: invalid mode; mode=" + mode);
  			}
  			return cipher.doFinal(message);
  		} catch (Exception e) {
  			throw new SymmetricEncryptionException("error encrypting/decrypting message; mode=" + mode, e);
  		}
  	}
docs: Encrypts/decrypts a message based on the underlying mode of operation.
  
  @param key the encryption key
  @param initializationVector the initialization vector
  @param message if in encryption mode, the clear-text message, otherwise
  the message to decrypt
  @return if in encryption mode, the encrypted message, otherwise the
  decrypted message
  @throws SymmetricEncryptionException on runtime errors
  @see #setMode(Mode)