Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Android Secure Message Protocol

An Android app that sends encrypted SMS through an SMPP gateway, then checks that the server received exactly what was sent.

نسخه فارسی

Built with samanmohammadraouf, who wrote the server: SMPP_Server. The original repo is samanmohammadraouf/AndroidSecureMessageProtocol.

Send a message Ack received
send sms receive ack
Phone SMS app Our inbox Settings
android messages app messages settings

Server side:

server result

How it works

  1. Send. You type a number and a message. The app encrypts the text with AES, wraps it in $$ markers and sends it as an SMPP SUBMIT_SM through the gateway, using Cloudhopper SMPP.
  2. Ack. The server decrypts the message and replies by SMS with the SHA-256 hash of the text. Replies that end with | AFTSTC are acks.
  3. Check. The app catches incoming SMS with a BroadcastReceiver, decrypts them and compares the hash in the ack with the hash of what it sent. If the hash and the number both match, the message is marked as delivered. If not, the app asks you to send it again, because the message may have been changed on the way.
  4. Inbox. Sent and received messages are read from Android's SMS store, decrypted and shown as a chat.

Gateway host, port, username, password and the key are set once in Settings and kept in SharedPreferences.

At first we also received messages over SMPP, but the Ozeki gateway kept dropping the connection while it ran in the background. Receiving through a BroadcastReceiver fixed that.

Try it

  1. Install Ozeki SMPP SMS Gateway Lite on a phone and connect it.
  2. Install SmppClient (this app) and enter the gateway details in Settings.
  3. For the key, use your own or the demo key a7b2c3d4e5f6g789abcdef0123456789. The server has to use the same key.
  4. Run SMPP_Server.

Code

File What it does
Smpp.kt SMPP session and sending
SMSReceiver.kt Catches incoming SMS, decrypts them, spots acks
SecurityUtil.kt AES encryption and SHA-256 hashing
MainActivity.kt Send screen and the ack check
SMSActivity.kt Inbox
SettingsActivity.kt Gateway and key settings

Kotlin, Android 6.0 and up (min SDK 23).

Known limits

This was a learning project, so the encryption is simple: AES in CBC mode with an all zero IV, and the key is used directly as bytes. A real version would use a random IV for every message and an authenticated mode such as AES GCM.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages