private Intent createSendIntent(byte[] resultBytes) {
    Intent sendIntent;
    sendIntent = new Intent(Intent.ACTION_SEND);
    sendIntent.setType(Constants.ENCRYPTED_TEXT_MIME);
    sendIntent.putExtra(Intent.EXTRA_TEXT, new String(resultBytes));

    EncryptActivity modeInterface = (EncryptActivity) getActivity();
    EncryptModeFragment modeFragment = modeInterface.getModeFragment();
    if (!modeFragment.isAsymmetric()) {
      return sendIntent;
    }

    String[] encryptionUserIds = modeFragment.getAsymmetricEncryptionUserIds();
    if (encryptionUserIds == null) {
      return sendIntent;
    }

    Set<String> users = new HashSet<>();
    for (String user : encryptionUserIds) {
      KeyRing.UserId userId = KeyRing.splitUserId(user);
      if (userId.email != null) {
        users.add(userId.email);
      }
    }
    // pass trough email addresses as extra for email applications
    sendIntent.putExtra(Intent.EXTRA_EMAIL, users.toArray(new String[users.size()]));

    return sendIntent;
  }
  protected SignEncryptParcel createOperationInput() {

    if (mMessage == null || mMessage.isEmpty()) {
      Notify.create(getActivity(), R.string.error_empty_text, Notify.Style.ERROR).show(this);
      return null;
    }

    // fill values for this action
    SignEncryptParcel data = new SignEncryptParcel();

    data.setBytes(mMessage.getBytes());
    data.setCleartextSignature(true);

    if (mUseCompression) {
      data.setCompressionId(PgpConstants.sPreferredCompressionAlgorithms.get(0));
    } else {
      data.setCompressionId(CompressionAlgorithmTags.UNCOMPRESSED);
    }
    data.setHiddenRecipients(mHiddenRecipients);
    data.setSymmetricEncryptionAlgorithm(
        PgpConstants.OpenKeychainSymmetricKeyAlgorithmTags.USE_PREFERRED);
    data.setSignatureHashAlgorithm(
        PgpConstants.OpenKeychainSymmetricKeyAlgorithmTags.USE_PREFERRED);

    // Always use armor for messages
    data.setEnableAsciiArmorOutput(true);

    EncryptActivity modeInterface = (EncryptActivity) getActivity();
    EncryptModeFragment modeFragment = modeInterface.getModeFragment();

    if (modeFragment.isAsymmetric()) {
      long[] encryptionKeyIds = modeFragment.getAsymmetricEncryptionKeyIds();
      long signingKeyId = modeFragment.getAsymmetricSigningKeyId();

      boolean gotEncryptionKeys = (encryptionKeyIds != null && encryptionKeyIds.length > 0);

      if (!gotEncryptionKeys && signingKeyId == Constants.key.none) {
        Notify.create(
                getActivity(), R.string.select_encryption_or_signature_key, Notify.Style.ERROR)
            .show(this);
        return null;
      }

      data.setEncryptionMasterKeyIds(encryptionKeyIds);
      data.setSignatureMasterKeyId(signingKeyId);
    } else {
      Passphrase passphrase = modeFragment.getSymmetricPassphrase();
      if (passphrase == null) {
        Notify.create(getActivity(), R.string.passphrases_do_not_match, Notify.Style.ERROR)
            .show(this);
        return null;
      }
      if (passphrase.isEmpty()) {
        Notify.create(getActivity(), R.string.passphrase_must_not_be_empty, Notify.Style.ERROR)
            .show(this);
        return null;
      }
      data.setSymmetricPassphrase(passphrase);
    }
    return data;
  }