private static byte[] generateIv(int ivLength) {
    SecureRandom random = ZiftrUtils.createTrulySecureRandom();

    if (random == null) {
      String rngError = ZWApplication.getApplication().getString(R.string.zw_dialog_error_rng);
      ZiftrDialogManager.showSimpleAlert(rngError);
    }

    byte[] iv = new byte[ivLength];
    random.nextBytes(iv);
    return iv;
  }
  public static String generateSalt() throws ZWKeyCrypterException {
    try {
      SecureRandom random = ZiftrUtils.createTrulySecureRandom();
      if (random == null) {
        String rngError = ZWApplication.getApplication().getString(R.string.zw_dialog_error_rng);
        ZiftrDialogManager.showSimpleAlert(rngError);
      }

      byte[] salt = new byte[SALT_LENGTH];
      random.nextBytes(salt);
      String saltHex = ZiftrUtils.bytesToHexString(salt);
      try {
        ZLog.log("salt: " + salt);
      } catch (Exception e) {
        System.out.println("salt: " + saltHex);
      }
      return saltHex;
    } catch (Exception e) {
      throw new ZWKeyCrypterException("Unable to generate salt", e);
    }
  }