code: public String encrypt(String string, SecretKey key) {
  
          // Basic null check.
          // An empty string can be encrypted:
          if (string == null) {
              return null;
          }
  
          Cipher cipher = getCipher();
  
          // Convert the input Sting to a byte array:
          byte[] iv = Generate.byteArray(getIvSize(cipher));
          byte[] data = ByteArray.fromString(string);
  
          // Encrypt the data:
          byte[] result = encrypt(iv, data, key, cipher);
  
          // Prepend the IV
          result = ArrayUtils.addAll(iv, result);
  
          // Return as a String:
          return ByteArray.toBase64(result);
      }
docs: This method encrypts the given String, returning a base-64 encoded
  String. Note that the base-64 String will be longer than the input String
  due base-64 encoding and the inclusion of an initialisation vector.
  <p>
  A fixed length database field can therefore hold less encrypted than
  plain-text data.
  
  @param string The input String.
  @param key    The key to be used to encrypt the String.
  @return The encrypted String, base-64 encoded, or null if the given
  String is null. An empty string can be encrypted, but a null one
  cannot.
  @throws IllegalArgumentException If the given key is not a valid {@value #CIPHER_ALGORITHM}
  key.
  @see #decrypt(String, SecretKey)