Experimenting with RSA + AES for True End-to-End Encryption
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.