CASE STUDY // 03•Secure Communications

Entangle

Entangle is an Android post-quantum hybrid encrypted messenger engineered with Jetpack Compose, featuring client-side X25519 ECDH key agreement, AES-256-GCM payload encryption, and zero-knowledge cloud relaying.

01

Project Overview

Entangle is an Android post-quantum hybrid encrypted messenger engineered with Jetpack Compose, featuring client-side X25519 ECDH key agreement, AES-256-GCM payload encryption, and zero-knowledge cloud relaying.

02

Problem Statement

Contemporary mobile messaging applications present opaque cryptographic implementations or store sensitive metadata in proprietary cloud infrastructure. Furthermore, standard end-to-end encrypted messaging systems rely exclusively on classical elliptic curve cryptography (Curve25519 / NIST P-256), rendering all stored encrypted communications permanently decipherable once quantum computers achieve cryptanalytic scale.

03

Objectives & Scope

Project Objectives

  • 01Ensure zero-knowledge data transport where the relay never sees unencrypted payloads
  • 02Implement X25519 key agreement with post-quantum hybrid scaffolding
  • 03Protect each individual message with authenticated AES-256-GCM and unique IVs
  • 04Secure user keys utilizing hardware-backed Android Keystore storage
  • 05Provide a clean, reactive mobile user interface via modern Jetpack Compose

Scope & Boundary

Mobile peer-to-peer authenticated messaging, client-side cryptographic key lifecycle, and encrypted message transit over untrusted transport. Multi-device account synchronization and multi-party group ratchets (e.g., Double Ratchet / MLS) are reserved for future phases.

04

Threat Model & Requirements

Threat Model: Compromised cloud relay server and active network eavesdropper. Attacker capabilities: Read, inject, delay, or replay packets in the cloud database; inspect network traffic on untrusted Wi-Fi. Security bounds: Cloud provider is assumed untrusted; client devices are trusted until physical device compromise.

05

Architecture

Device A generates an ephemeral key pair and computes a shared secret with Device B's public key using X25519 ECDH. The derived secret is fed into HKDF to generate symmetric keys. Outgoing messages are encrypted with AES-256-GCM using unique IVs. Ciphertext is published to Firestore. Device B listens to the collection, pulls ciphertext, and deciphers locally using its private key.

FIG 1.0 // PROJECT LAUNCH FILM & EXECUTION TEASER (1080P)
Entangle Launch Film
0.0s / 20.0s30 FPS
SOUND: OFF (CLICK UNMUTE)
|
|
FIG 1.1 // SYSTEM ARCHITECTURE & FLOW
+-------------------------------------------------------------------+
|                    ENTANGLE E2EE ARCHITECTURE                     |
+-------------------------------------------------------------------+
|                                                                   |
|   Alice (Android Device)                     Bob (Android Device) |
|   +-------------------+                     +-------------------+ |
|   |  Android Keystore |                     |  Android Keystore | |
|   |  PrivKey_A (ECC)  |                     |  PrivKey_B (ECC)  | |
|   +-------------------+                     +-------------------+ |
|             |                                         |           |
|     Compute X25519 ECDH                       Compute X25519 ECDH |
|   SharedSecret = ECDH(A, B)                 SharedSecret = ECDH(B, A)
|             |                                         |           |
|      HKDF-SHA256                               HKDF-SHA256        |
|             |                                         |           |
|   AES-256-GCM Encrypt                       AES-256-GCM Decrypt   |
|   Payload -> Ciphertext                     Ciphertext -> Payload |
|             |                                         ^           |
|             v                                         |           |
|       +---------------------------------------------+ |           |
|       |       Untrusted Firebase Cloud Relay        | |           |
|       | (Stores Ciphertext, IV, AuthTag only)       |-+           |
|       +---------------------------------------------+             |
|                                                                   |
+-------------------------------------------------------------------+
FIG 1.2 // ARCHITECTURAL KNOWLEDGE TREE & SYSTEM DECOMPOSITION

Entangle Architecture Decomposition

Zero-knowledge end-to-end encrypted mobile messaging architecture featuring Double Ratchet session ratcheting, post-quantum hybrid key agreements, and Android Jetpack Compose client interface.

SUBSYSTEMS:
PROJECT

Entangle Architecture

.
CATEGORY

Cryptographic Core

.
PROTOCOL
↗

Double Ratchet Protocol

.
ALGORITHM
↗

X25519 ECDH

.
ALGORITHM
↗

ChaCha20-Poly1305

.
CATEGORY

Mobile Client (Android)

.
FRAMEWORK
↗

Jetpack Compose

.
DATABASE
↗

SQLCipher Encrypted DB

.
SECURITY CONTROL
↗

Android Keystore System

.
CATEGORY

Zero-Knowledge Relay

.
FRAMEWORK
↗

FastAPI Async Gateway

.
INFRASTRUCTURE
↗

Redis Pub/Sub Bus

.
NODES: 12 ACTIVE•SCALE: 46%PAGE SCROLL: NORMAL
06

Implementation

Engineered an Android end-to-end encrypted messaging platform using Kotlin and Jetpack Compose. Built a client-side cryptographic architecture where key generation, key agreement, and payload encryption occur strictly on the user's mobile device. Implemented X25519 Elliptic Curve Diffie-Hellman (ECDH) key exchange augmented with post-quantum key agreement primitives. Encrypted message bodies are sealed using AES-256-GCM authenticated cipher with unique initialization vectors per message. Cloud relays (Firebase Firestore) operate purely as blind ciphertext stores with zero visibility into plaintext content.

07

Technologies & Rationale

Jetpack Compose & Kotlin

Type-safe, memory-safe mobile environment eliminating memory corruption vulnerabilities common in legacy mobile C/C++ native messaging wrappers.

X25519 ECDH

High-performance, timing-attack-resistant Curve25519 Diffie-Hellman key exchange providing 128-bit classical security with 32-byte public keys.

AES-256-GCM

Ensures ciphertext confidentiality while providing 128-bit authentication tags that guarantee messages cannot be forged or modified in transit.

Zero-Knowledge Relay Pattern

The backend cloud storage only receives ciphertext blobs, sender IDs, and IVs; private cryptographic keys never leave the hardware-backed Android Keystore.

08

Testing Methodology

Verified round-trip cryptographic execution across dual physical Android test devices and emulators. Validated tampering detection: modifying a single bit in the ciphertext or authentication tag immediately throws an AEADBadTagException, preventing message presentation. Validated zero-leakage by inspecting raw Firebase documents to ensure no plaintext artifacts exist.

09

Results & Evidence

Full end-to-end encryption achieved. Message encryption and decryption execute in sub-10ms intervals on modern Android devices. Zero unencrypted data persisted on remote infrastructure.

10

Limitations & Trade-offs

Currently implements peer-to-peer messaging; group messaging requires multi-recipient ratchet protocols. Post-quantum hybrid integration currently uses pre-shared hybrid hints rather than full on-device ML-KEM exchange. Key backup and recovery flows are not yet implemented.

11

Future Improvements

Implement the Signal Double Ratchet protocol for per-message forward secrecy and break-in recovery. Integrate full ML-KEM-768 on Android via Bouncy Castle PQC. Support encrypted media attachments with chunked stream encryption.

12

Resources & Code

VIEW REPOSITORY ON GITHUB ↗

Repository URL: https://github.com/prajwalk-cyber/Entangle