Menu
CodeSprout
Typo-tolerant search across every article, problem and post. to open

Experimenting with RSA + AES for True End-to-End Encryption

kvi5hnu3 minutes 40 secondsWatch on YouTube
0comments

Notes

🔐 Experimenting with RSA + AES for True End-to-End Encryption

play store: https://lnkd.in/gxSFJtxr

Why Not Just RSA?
At first, I considered using only RSA for encrypting messages, but it didn’t take long to realize why that wouldn’t work:

  • RSA can’t encrypt large messages efficiently – a 2048-bit RSA key can only encrypt about 245 bytes of data at a time.

  • Encrypting full messages with RSA is extremely slow and resource-intensive, making it impractical for real-time messaging.

  • It increases computational load, which can significantly impact mobile performance.

Why AES + RSA Works Best

  • Instead of encrypting entire messages with RSA, I took a hybrid approach:
    AES (Advanced Encryption Standard) encrypts the actual message – fast & efficient even for large data.

  • RSA (Rivest-Shamir-Adleman) encrypts only the AES key – ensuring secure key exchange.

  • This way, messages remain secure, encryption remains efficient, and decryption is near-instant.

Key Pair Management & Message Security
# Another interesting challenge was ensuring message persistence while maintaining security. Here’s how I handled it:

  • Key pairs are generated on app install, device change, or reset.

  • If key pairs change, old messages become unreadable but remain visible—no one, not even me, can decrypt them without the original private key.

This guarantees true end-to-end encryption, meaning only the sender and recipient can ever read the messages.

Seamless Deep Linking & Secure Message Sharing

To make this encryption model practical, I integrated deep linking:

✅ Users can create, revoke, and regenerate secure message links anytime.
✅ Deep links allow opening and sending anonymous messages from the web directly into the app [provided the app is installed].
✅ Links work across platforms—including WhatsApp, Instagram, and Telegram—without compromising security.

FCM for Secure Notifications

  • End-to-end encryption isn’t complete without secure notifications. Using Firebase Cloud Messaging (FCM):

  • Notification payloads contain no actual message content—just an alert to the recipient.

  • Messages are only retrieved and decrypted inside the app, ensuring privacy.

This experiment reinforced why WhatsApp, Signal, and other secure messengers also use AES + RSA instead of pure RSA encryption. It’s the best of both worlds—strong security without sacrificing speed.

#Encryption #DataPrivacy #EndToEndEncryption #AES #RSA #SecureMessaging #TechExperiment #DataProtection #AnonymousMessaging #jetpackcompose #android

Discussion

Sign in to ask a question or share what you learned.