I am working on a cryptography Android application for a course project. My goal is to be able to send an encrypted message (composed of a key and ciphertext) from my application via a text message.
I have been trying to send the key and ciphertext as a Bundle, but am running into issues - when I actually attempt to send the Bundle, it is not appearing in the default text messaging app. My code is below and any help/pointing me in the right direction would be greatly appreciated!
Thanks!
Intent sendIntent = new Intent();
Bundle extras = new Bundle();
extras.putString("Key", key.getText().toString());
extras.putString("Ciphertext", cipherText.getText().toString());
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtras(extras);
sendIntent.setType("text/plain");
startActivity(sendIntent);
My goal is to be able to send an encrypted message (composed of a key and ciphertext) from my application via a text message.
That would be pointless, as then anyone can decrypt the message.
when I actually attempt to send the Bundle, it is not appearing in the default text messaging app
ACTION_SEND
does not support arbitrary extras, such as Key
or Ciphertext
.
The sharing Intent
using ACTION_SEND
follows a specific format in order for the receiving so app to understand the data. In this case, you would need to provide the message text (your combination of key and cipher text) as an extra using the key Intent.EXTRA_TEXT
. See this page for more details: https://developer.android.com/training/sharing/send.html
Also, unless that key you are sending is a public key, this is bad practice.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.