Architecture & Cryptography

This page explains how AENC protects your data. It covers the building blocks it uses, where each one applies, and how they fit together. You will find it useful if you want to check the design yourself.

Contents
  1. Overview & threat model
  2. Cryptographic primitives
  3. The end-to-end flow
  4. Identities & keys
  5. Sealed-sender messages
  6. Hybrid post-quantum mode
  7. Identity key file at rest (.aekey)
  8. Pairing certificates & verification (.aepair)
  9. Contact book (.aecb)
  10. Removable-key mode & memory hygiene
  11. Resistance to digital forensics
  12. Build variants & network behavior

1. Overview & threat model

AENC is an offline encryption tool, not a messenger. It never sends your content anywhere. You build a self contained encrypted package on your device and share it over any channel you already use. Only the person you picked can open it. No AENC server takes part in encryption or decryption, so there is no metadata about who talks to whom, or when, for anyone to collect.

What AENC protects. It keeps your content private and genuine while it travels over channels you do not trust. It keeps your private keys secret even if you lose the phone or someone installs a fake copy of the app. What it does not claim. It cannot protect an unlocked device in an attacker's hands, and it does not pretend the client side anti tamper is unbreakable. Those measures only raise the cost of an attack. The real boundary is simple. Your private keys live off the device, on removable media.

2. Cryptographic primitives

PrimitiveRole in AENC
X25519 (ECDH)Key agreement between sender and recipient for every encrypted message.
AES-256-GCMAuthenticated encryption (AEAD) of the message payload and of the identity file at rest.
Ed25519Digital signatures. They authenticate a message in SIGNED mode and self sign a pairing certificate.
sntrup761 (Streamlined NTRU Prime)Post quantum KEM. It combines with X25519 in the optional hybrid mode.
HKDF-SHA-256Key derivation. It turns the shared secrets from key agreement into a fresh AEAD key for each message.
Argon2idMemory hard password hashing (64 MiB, 3 passes, 1 lane). It protects the identity file with your passphrase.
SHA-256Pairing fingerprints and domain separated hashing.

All formats use canonical CBOR (CTAP2 canonical). The exact header and envelope bytes serve verbatim as AEAD associated data. Before it runs any crypto, the decoder rebuilds the input and compares it byte for byte, so it rejects anything that is not canonical or has been changed.

3. The end-to-end flow

Your phone AENC: encrypt plaintext → .aenc Any channel Telegram · email · USB carries ciphertext only Their phone AENC: decrypt .aenc → plaintext .aenc .aenc No AENC server is ever contacted. The channel sees only an opaque encrypted blob.
Figure 1. AENC sits on top of your existing apps. It makes and opens encrypted files, but it never carries them.

4. Identities & keys

An identity is a set of key pairs that AENC generates on your device.

You share the public halves as a pairing certificate (§8). The private halves stay in the encrypted .aekey file, which you keep on a removable drive (we recommend this) or on the phone. AENC loads them into memory only while the identity is unlocked (§10).

5. Sealed-sender messages

Each encrypted item is a self contained package (magic AES2 for text, AEF2 for files). "Sealed sender" means AENC encrypts the sender's identity inside the package. Anyone who intercepts it sees no sender, no recipient name, only opaque bytes.

Recipient public key X25519 (+ sntrup761 if PQ) Sender key Ed25519 (auth), X25519 (deniable) Plaintext padded to hide length Ephemeral key agreement (KEM) X25519 ECDH · optional sntrup761 encapsulation HKDF-SHA-256 → content key (CEK) 32-byte AES-256-GCM key, per message Inner (encrypted), the "sealed" part sender Ed25519 public key · signature (SIGNED) or MAC (DENIABLE) · created_at · padded message → AES-256-GCM(CEK), AAD = exact header ‖ envelope bytes .aenc package header (cleartext = AAD) · envelope (wrapped CEK) · ciphertext + GCM tag
Figure 2. Every message gets a fresh content key from a one time key agreement. The sender's identity and authenticator live inside the AEAD ciphertext.

Authentication modes

AENC computes the signature or MAC over a length prefixed transcript. That transcript binds the header, the wrapped key, the sender key, the timestamp and the message, so nothing can be swapped between packages.

6. Hybrid post-quantum mode

A Post Quantum identity carries an extra sntrup761 key. When both sides are PQ, AENC derives the content key from both an X25519 ECDH secret and an sntrup761 encapsulation, and mixes them through HKDF. An attacker has to break both to recover the key. So your message stays private even against a future quantum computer, and it stays at least as strong as X25519 is today.

Types must match. A Classical identity and a Post Quantum identity cannot message each other. You both need the same type. A coloured badge shows which one you have. Blue means Classical, green means Post Quantum.

7. Identity key file at rest (.aekey)

AENC stores your identity as an encrypted .aekey file, protected by your passphrase.

Passphrase your secret Argon2id · 64 MiB · 3 passes · salt → KEK (AES-256 key) AES-256-GCM(KEK) → .aekey encrypts the whole identity payload (all keys · name · device id)
Figure 3. A memory hard KDF stretches your passphrase into the key that encrypts your whole identity with AES GCM.

Argon2id is slow and memory hard on purpose (64 MiB, 3 passes). That makes cracking a stolen .aekey expensive, so pick a long, strong passphrase. For the best protection, keep the file on a removable USB drive and pull it out when you are done. You can store it on the phone, but that is less secure.

8. Pairing certificates & verification (.aepair)

To message someone, you import their public pairing certificate, usually by scanning a QR code in person. The certificate signs itself and carries no name.

Bundle (public) version, device id, suites X25519 public key Ed25519 public key sntrup761 public key (PQ) canonical CBOR Ed25519 self signature proof of key possession .aepair → QR / file "AENC1:" text (base64url) animated multi frame QR for PQ fingerprint = SHA-256(bundle) compared out of band
Figure 4. The certificate proves nobody changed the bundle on the way. To verify the person, you still compare the fingerprint face to face.

When you import a certificate, AENC rebuilds the bundle canonically and compares it byte for byte, checks that the advertised cipher suites match the keys inside, and verifies the Ed25519 self signature. It does all of this before it trusts anything. The fingerprint is a domain separated SHA-256 over the whole bundle. Two people compare it in person to stop anyone slipping in the middle at pairing time. A contact stays unverified until you confirm it.

9. Contact book (.aecb)

Your contacts live only in memory during a session. To keep them, AENC saves them as an encrypted .aecb file. It encrypts that file with a subkey from your identity, so only you can open your own contact book, and the book is tied to the identity that made it. The book records whether each contact is verified.

10. Removable-key mode & memory hygiene

11. Resistance to digital forensics

AENC is built so that examining the phone turns up almost nothing. Forensic tools recover what an app leaves behind, things like databases, caches, logs, thumbnails, and files that were deleted but not overwritten. AENC leaves none of that on purpose.

The one weak moment, and how to avoid it. Forensics has a real chance only if someone grabs the device while it is unlocked, with the USB key inserted and a session open. That is the short window when keys are in memory. Pull the drive and lock when you are done. After that, even with full physical access and professional tools, there is next to nothing to recover.

12. Build variants & network behavior

AENC ships as two builds from one codebase. The crypto core described above is identical in both, byte for byte. They differ only in how you get a licence and whether the app may use the network. Encryption always runs fully on your device. Neither build ever sends your message content, ciphertext, contacts or private keys.

Offline build (foss) AENC on device encrypt · decrypt · keys in RAM / USB no INTERNET permission the OS blocks every socket, nothing leaves Play build (play) AENC + INTERNET license.aenc.io Google Play Google APIs
Figure 5. The OS seals the offline build. The Play build uses the network only for licensing and Google Play plumbing, never for your content.

Endpoints the Play build contacts

EndpointOwnerPurposeData sentContent / keys
license.aenc.ioAENCOnly for the optional paid feature (built in messenger, coming soon). It activates and quietly refreshes that licence. Offline encryption is free and never contacts this server.Play purchase token, Play Integrity token, opaque device id, product idnever
Google Play Services
(on device → Google)
GooglePlay Billing purchase flow + Play Integrity attestationPurchase / subscription state, integrity verdictnever
play.google.com/store/apps/detailsGoogleAnti tapjacking. Is an enabled accessibility service published on Play (200) or sideloaded (404)?Package names of enabled third party accessibility servicesnever
firebaselogging.googleapis.com
firebaselogging-pa.googleapis.com
GoogleTelemetry bundled transitively by Google Play Billing (not AENC code)Device model, build fingerprint, SIM operator (mcc_mnc), locale, timezone, network typenever

Bottom line. All of that traffic uses HTTPS with TLS, and it covers only licensing and Google Play platform plumbing. The offline build sends nothing at all. In neither build does any message content, ciphertext, contact, or private key ever leave the device. The Play listing's Data Safety declaration reflects the online build's traffic.