code: private Cipher cipher(final int mode, final AlgorithmParameterSpec spec)
          throws IOException {
          try {
              final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
              cipher.init(mode, this.key, spec, this.random);
              return cipher;
          } catch (final InvalidKeyException | NoSuchAlgorithmException
              | InvalidAlgorithmParameterException
              | NoSuchPaddingException ex) {
              throw new IOException(ex);
          }
      }
docs: Create new cipher based on the valid mode from {@link Cipher} class.
  
  @param mode Either Cipher.ENRYPT_MODE or Cipher.DECRYPT_MODE
  @param spec Param spec (IV)
  @return The cipher
  @throws IOException For any unexpected exceptions