Reputation: 33
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);
Upvotes: 0
Views: 250
Reputation: 15775
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.
Upvotes: 1
Reputation: 1007296
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
.
Upvotes: 1