code: private byte[] doFinal(int encryptMode, SecretKey generatedKey, String vector, byte[] message) {
          try {
              byte[] raw = decodeHex(vector);
              Cipher cipher = Cipher.getInstance(transformation);
              cipher.init(encryptMode, generatedKey, new IvParameterSpec(raw));
              return cipher.doFinal(message);
          } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException |
                  InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException e) {
              throw new IllegalStateException(e);
          }
      }
docs: Utility method encrypting/decrypting the given message.
  The sense of the operation is specified using the `encryptMode` parameter.
  
  @param encryptMode  encrypt or decrypt mode ({@link javax.crypto.Cipher#DECRYPT_MODE} or
  {@link javax.crypto.Cipher#ENCRYPT_MODE}).
  @param generatedKey the generated key
  @param vector       the initialization vector
  @param message      the plain/cipher text to encrypt/decrypt
  @return the encrypted or decrypted message