A post-quantum end-to-end encrypted email service

The Secria Mail protocol in full. Read it in plain words.

Last updated November 2026 · Secria team

Abstract#

Secria is an end-to-end encrypted email service designed to resist both classical and quantum cryptanalytic attacks. The protocol employs a hybrid key encapsulation mechanism combining ML-KEM-1024 (FIPS 203) with X25519 Elliptic Curve Diffie-Hellman, ensuring that compromise of either primitive alone does not break message confidentiality. Messages are protected by a two-stage encryption architecture: per-recipient key encapsulation wraps a shared symmetric key, which in turn encrypts the message payload via AES-256. Password-derived keys are computed on the device with Argon2 (RFC 9106), and the server never receives plaintext passwords or private keys. Mail between Secria accounts reaches the server only encrypted. This paper describes the cryptographic protocol, key management lifecycle, threat model, and security architecture of the Secria platform.

1. Introduction#

Email remains the most widely used form of digital communication, yet the underlying protocols (SMTP, IMAP and POP3) were designed in an era when network eavesdropping was not a primary concern. While TLS has addressed transport-layer security, the fundamental problem remains: email content is readable by any server in the delivery chain. Providers, governments, and attackers who compromise infrastructure can access message contents at rest.

Existing end-to-end encrypted email solutions have made significant progress in addressing this gap. However, the emergence of cryptographically relevant quantum computers (CRQCs) poses a new threat. Shor's algorithm can efficiently solve the integer factorization and discrete logarithm problems underlying RSA, DSA, and elliptic curve cryptography. The "harvest now, decrypt later" attack model, where adversaries record encrypted traffic today for future quantum decryption, makes post-quantum migration urgent even before CRQCs are operational.

Secria addresses this threat by implementing a hybrid post-quantum key exchange that combines the NIST-standardized ML-KEM-1024 lattice-based key encapsulation mechanism with X25519 elliptic curve Diffie-Hellman. This hybrid approach provides security against both classical and quantum adversaries: an attacker must break both primitives to recover message contents.

1.1 Design principles#

  • Zero-access architecture. The server never receives plaintext passwords or private keys. Keys are made, and messages are encrypted and decrypted, on the client. Mail to and from other providers travels over standard SMTP: the server encrypts incoming mail to the recipient's public keys on arrival, and delivers outgoing mail to the recipient's server (Section 12).
  • Post-quantum readiness. Message keys are exchanged with hybrid ML-KEM-1024 + X25519 encapsulation, providing defense against harvest-now-decrypt-later attacks.
  • Minimal trust surface. A compromised server has no key to decrypt stored messages. Like any web-delivered client, the web app trusts the code the server sends it.
  • Simplicity and auditability. The protocol uses well-studied, standardized primitives from widely used libraries. Its specification, reference implementations and test vectors are public at github.com/Secria/secria-crypto.
  • Cross-platform consistency. Web, iOS and Android clients read and write the same message and key formats.

2. Threat model#

2.1 Adversary capabilities#

AdversaryCapabilitiesSecria's defense
Network eavesdropperPassive interception of all network trafficTLS transport encryption + E2E encryption of message payloads
Compromised serverFull read/write access to server storage and databasesThe server stores private keys only wrapped under the client-derived vault key, and message bodies and attachments only encrypted. It holds no key that opens them.
Quantum adversaryAccess to a cryptographically relevant quantum computerML-KEM-1024 key encapsulation resists quantum attacks. Hybrid construction ensures classical X25519 provides defense if the lattice scheme is broken by classical means.
Harvest-now-decrypt-laterRecords all ciphertext today for future quantum decryptionHybrid ML-KEM-1024 + X25519 with per-message randomness keeps recorded ciphertext sealed against future quantum capabilities
Malicious recipientA Secria user who attempts to forge or alter messagesPer-recipient key encapsulation prevents cross-recipient key recovery. AES-GCM authentication on key wrapping detects tampering. Secria's servers only send from addresses the account owns, and refuse outside mail that claims a Secria address.

2.2 Defense in depth#

  • Device-level protection. Biometric authentication (Face ID, fingerprint), automatic memory clearing on background, and privacy screen overlays protect against physical access and shoulder-surfing attacks. Platform-native secure storage (iOS Keychain, Android Keystore) provides hardware-backed key protection.
  • Content isolation. Emails are rendered inside sandboxed iframes with strict CSP, DOMPurify sanitization, and URI protocol whitelisting, preventing phishing, XSS, and script injection attacks originating from email content.
  • Tracking prevention. Automatic pixel tracker detection and stripping, combined with a server-side image proxy, stop tracking pixels from reporting opens and keep the recipient's IP address hidden from senders.
  • No analytics. The apps include no analytics, advertising or error-reporting libraries.

3. Cryptographic primitives#

3.1 Primitive selection#

FunctionPrimitiveStandardLibrary
Post-quantum key encapsulationML-KEM-1024FIPS 203mlkem
Classical key exchangeX25519RFC 7748@noble/curves
Key derivationHKDF-SHA-256RFC 5869@noble/hashes
Password hashingArgon2id, and Argon2d for the sign-in shared with the VPN appsRFC 9106argon2-browser
Symmetric encryption (key wrapping)AES-256-GCMNIST SP 800-38DWeb Crypto API
Symmetric encryption (message body)AES-256-GCMNIST SP 800-38DWeb Crypto API
HashingSHA-256FIPS 180-4@noble/hashes
Random number generationcrypto.getRandomValuesWeb Crypto APIBrowser engine

All cryptographic libraries used (@noble/curves, @noble/hashes, mlkem) are widely used libraries with no native dependencies, so they behave the same on every platform. @noble/hashes and @noble/curves each publish an outside security review of their own code by Cure53 (January 2022 and September 2024, of earlier versions); mlkem has none published. These reviews cover the libraries, not Secria's own code.

3.2 ML-KEM-1024#

ML-KEM (Module-Lattice-Based Key-Encapsulation Mechanism), formerly known as CRYSTALS-Kyber, was standardized by NIST in FIPS 203 (August 2024). Secria uses the ML-KEM-1024 parameter set, which provides NIST Security Level 5, equivalent to AES-256 against quantum adversaries.

Public keyPrivate keyCiphertextShared secret
1,568 B3,168 B1,568 B32 B

3.3 X25519#

X25519 (RFC 7748) is an elliptic curve Diffie-Hellman function on Curve25519, providing ~128 bits of classical security. In Secria, X25519 serves as the classical component of the hybrid key exchange, ensuring security against non-quantum adversaries even if ML-KEM is found to have weaknesses.

3.4 Hybrid construction rationale#

The hybrid approach concatenates the ML-KEM shared secret with the X25519 shared secret before key derivation:

IKM = mlkem_shared_secret || x25519_shared_secret

This construction ensures that the derived key is at least as strong as the stronger of the two components. An adversary must break both ML-KEM-1024 and X25519 to recover the input keying material. This follows the conservative approach permitted by NIST and adopted by standards such as TLS 1.3 hybrid key exchange.

4. Key generation and management#

4.1 User key material#

Upon registration, each Secria user generates the following key material entirely client-side:

KeyTypeSizePurpose
ML-KEM-1024 keypairAsymmetric1,568 B / 3,168 BPost-quantum key encapsulation
X25519 keypairAsymmetric32 B / 32 BClassical Diffie-Hellman key exchange
Sent keySymmetric32 BSelf-encryption of sent mail and drafts
Key IDIdentifier32 BSHA-256 fingerprint of concatenated public keys

4.2 Vault key derivation#

The vault key is a 256-bit AES-GCM key derived from the user's password via Argon2id:

salt_vault = base64(SHA-256("vault" || address))
vault_key  = Argon2id(password, salt_vault, t=3, m=65536 KiB, p=1, tag_len=32)

The vault key is never transmitted to the server. It is used exclusively for encrypting/decrypting private key material.

4.3 Private key encryption#

All private key material is encrypted before leaving the client:

nonce = random(12 bytes)
ciphertext || tag = AES-256-GCM(vault_key, nonce, private_key_bytes)
stored = base64(nonce || ciphertext || tag)

The server stores only encrypted private key blobs alongside plaintext public keys. Without the vault key (derived from the user's password), the private keys are computationally infeasible to recover.

5. The two-stage encryption protocol#

Secria's message encryption uses a two-stage architecture that separates per-recipient key exchange from message-level symmetric encryption.

STAGE 1 (per-recipient)

  For each Secria recipient R:
    (ct_kem, ss_kem) ← ML-KEM-1024.Encap(R.pk_kem)
    ss_dh ← X25519(sender.sk_dh, R.pk_dh)
    salt ← random(32 bytes)
    K_first ← HKDF-SHA256(ss_kem || ss_dh, salt, "message-key", 32)
    wrapped_key_R ← AES-256-GCM(K_first, K_second)

  For sender (self-copy):
    salt_self ← random(32 bytes)
    K_self ← HKDF-SHA256(sent_key, salt_self, "message-key", 32)
    wrapped_key_self ← AES-256-GCM(K_self, K_second)

STAGE 2 (per-message)

  K_second ← random(32 bytes)
  IV ← random(12 bytes)
  ciphertext ← AES-256-GCM(K_second, IV, plaintext)
  output ← 0x02 || IV || ciphertext || tag

5.1 Stage 2: Message encryption#

A fresh 256-bit symmetric key (the second-stage key) is generated for each message. The entire message body (a fully-formed MIME document containing both text/plain and text/html representations) is encrypted with this key using AES-256-GCM. The 0x02 version byte enables forward-compatible algorithm negotiation. Bodies without it use the earlier AES-256-CBC encoding (format 1). A fresh second-stage key is generated for each message and seals only that message's body and attachments.

5.2 Stage 1: Per-recipient key encapsulation#

For each Secria recipient, the sender performs a hybrid key exchange to derive a first-stage key that wraps the second-stage key:

  1. Post-quantum: MlKem1024.encap(recipient.pk) produces a ciphertext and 32-byte shared secret
  2. Classical: X25519(sender.sk, recipient.pk) produces a 32-byte DH shared secret
  3. Key derivation: Both secrets are concatenated and fed into HKDF-SHA256 with a fresh 32-byte salt
  4. Key wrapping: The second-stage key is encrypted with AES-256-GCM using the derived first-stage key

5.3 Security properties#

PropertyMechanism
Quantum resistanceML-KEM-1024 (NIST Level 5) component in hybrid KEM
Classical resistanceX25519 component in hybrid KEM
Per-message key isolationFresh second-stage key and fresh HKDF salt per message
Recipient isolationEach recipient receives an independently encapsulated copy of the key
Ciphertext integrityAES-GCM authentication tags on every key wrap and on every format 2 body and attachment
Fresh keysEvery message gets a new message key, and every wrap a new salt, nonce and ML-KEM encapsulation

6. Decryption protocol#

6.1 Recipient decryption#

1. Parse envelope: extract mlkem_ciphertext, dh_public_key, salt,
   second_stage_key_encrypted for the current user

2. Post-quantum decapsulation:
   ss_kem ← MlKem1024.decap(ct_kem, my_mlkem_private_key)

3. Classical DH:
   ss_dh ← X25519(my_dh_private_key, sender_dh_public_key)

4. Derive first-stage key:
   K_first ← HKDF-SHA256(ss_kem || ss_dh, salt, "message-key", 32)

5. Unwrap second-stage key:
   K_second ← AES-256-GCM-Decrypt(K_first, second_stage_key_encrypted)

6. Decrypt message body:
   plaintext ← AES-256-GCM-Decrypt(K_second, message_ciphertext)

7. Parse MIME:
   Extract text/plain, text/html, inline images, and attachments

6.2 Self-decryption (sent mail)#

For messages the user sent, the client uses the self-encryption path:

1. K_self ← HKDF-SHA256(sent_key, salt, "message-key", 32)
2. K_second ← AES-256-GCM-Decrypt(K_self, second_stage_key_encrypted)
3. plaintext ← AES-256-GCM-Decrypt(K_second, message_ciphertext)

If the primary decryption path fails, for example after an account reset, the client tries the other path, so earlier mail stays readable.

7. Authentication and password handling#

7.1 Split password derivation#

Secria implements a split-derivation scheme that produces two values from the user's password:

Login hash (sent to server)

salt = base64(SHA-256(address))
hash = Argon2id(password, salt,
  t=3, m=65536, p=1, len=32)

Vault key (never leaves client)

salt = base64(SHA-256("vault" || address))
key  = Argon2id(password, salt,
  t=3, m=65536, p=1, len=32)

The apps also derive both values with Argon2d under SHA-1-derived salts (version 1), which the VPN apps use to sign in to the same account. SHA-1 only shortens the address into a fixed-length salt.

Separate salts: the login hash and the vault key are derived under different salts, so the login hash an account sends to the server is not its vault key and does not reveal it.

7.2 Multi-factor authentication#

Secria supports TOTP-based (RFC 6238) two-factor authentication. After password authentication, the server challenges for a time-based one-time code. TOTP activation requires providing the first valid code, and disabling requires a valid code, preventing unauthorized changes to MFA settings.

8. Account recovery#

8.1 BIP39 recovery phrase#

Secria implements an account recovery mechanism based on a 12-word mnemonic phrase, following the BIP39 specification. 128 bits of entropy are generated, checksummed with SHA-256, and encoded as 12 words from the standard BIP39 English wordlist.

8.2 Recovery key derivation#

recovery_key = HKDF-SHA256(
  IKM  = entropy,             // 16 bytes from mnemonic
  salt = "secria-recovery",   // static
  info = "recovery-key",      // static
  len  = 32                   // 256 bits
)

All three private keys (X25519, ML-KEM-1024, sent key) are encrypted with the recovery key using AES-256-GCM and stored on the server. The recovery key is derived from a completely separate path from the vault key, so the two are cryptographically unrelated.

8.3 Recovery flow#

The user provides their 12-word mnemonic and a new password. The client decodes the mnemonic, derives the recovery key, decrypts the private keys, validates all key lengths, re-encrypts with a new vault key derived from the new password, and re-encrypts with the same recovery key so the phrase remains valid. Users can regenerate their recovery phrase at any time, immediately invalidating the old one for account recovery.

9. Attachment encryption#

Attachments are encrypted with the same second-stage key as the message body, ensuring they share the message's full security properties including post-quantum protection:

Upload:   AES-256-GCM(K_second, IV, file_bytes) → encrypted blob
Download: AES-256-GCM-Decrypt(K_second, blob)  → file_bytes

Inline images referenced by cid: URIs in HTML email bodies are automatically fetched, decrypted, and converted to data: URIs for rendering. This ensures inline images are never loaded from external servers.

10. Transport and application security#

10.1 Content security policy#

The web app sets a Content-Security-Policy that loads scripts only from Secria's own origin, hCaptcha on the sign-up screen and Stripe on the checkout screen, and connects only to Secria's servers and those two providers.

10.2 Email rendering sandbox#

Received HTML emails are rendered inside a sandboxed iframe with multiple layers of protection:

  1. DOMPurify sanitization with forbidden elements (style, form, input, object, embed), all on* event handlers blocked, and URI protocol whitelist (https, http, mailto, tel, cid only)
  2. Iframe sandboxing: sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin"
  3. Iframe CSP: script-src 'none'; object-src 'none'
  4. External link interception: All link clicks are intercepted and require explicit user action to navigate

10.3 Pixel tracker detection#

Images with dimensions of 1x1 pixels or smaller, or images hidden via CSS, are automatically detected, stripped, and counted. Users are informed of the number of tracking pixels detected in each email.

10.4 Image privacy proxy#

All external image URLs in rendered emails are rewritten to route through Secria's server-side proxy, preventing external servers from learning the recipient's IP address or browser fingerprint.

10.5 No analytics#

Secria's apps include no analytics, advertising or error-reporting libraries. Human verification (hCaptcha) loads only on the sign-up screen and card payment (Stripe) only at checkout.

11. Mobile platform security#

Biometric authentication

Face ID, Touch ID, and fingerprint authentication. Credentials stored in platform-native secure storage with 30-day expiry.

Background privacy

Opaque overlay prevents app switcher screenshots. In-memory email data is cleared on background.

Push notification privacy

By default, push notifications carry only a generic alert, with no sender, subject or message content. Users can choose to show the sender and subject in Settings.

Deep link validation

All incoming deep links are validated against alphanumeric regex before navigation, preventing injection attacks.

PlatformStorage backendProtection
iOSiOS KeychainHardware-backed encryption, kept on this device only; the app can require Face ID or Touch ID
AndroidEncryptedSharedPreferencesAES-256-GCM with Android Keystore master key
WeblocalStorage + application encryptionOrigin-isolated, CSP-protected

12. Interoperability with legacy email#

12.1 Sending to non-Secria recipients#

When a Secria user writes to an address at another provider, the client encrypts the message and gives the server its message key over TLS. The server opens it and delivers it by SMTP with opportunistic TLS (STARTTLS). The sender's own copy is stored encrypted under the sender's keys. The client shows which recipients are Secria users and which are at other providers.

12.2 Receiving from non-Secria senders#

Incoming emails from external senders are immediately encrypted at rest by the server using the recipient's public keys before being stored, following the same two-stage encryption protocol. The server generates the ML-KEM ciphertext and X25519 DH shared secret, encrypts the message, and discards the plaintext. Even externally-received emails are stored with post-quantum encryption.

12.3 MIME compatibility#

Secria constructs standard RFC 2045/2046 MIME messages with multipart/alternative (text/plain + text/html) and multipart/mixed for attachments. Filenames are sanitized and binary payloads are Base64-encoded.

13. Conclusion#

Secria ships post-quantum end-to-end encryption to users today, on the web, iOS and Android. By combining ML-KEM-1024 with X25519 in a hybrid construction, Secria provides defense against both current and anticipated quantum threats, protecting users today against harvest-now-decrypt-later attacks.

The two-stage encryption architecture cleanly separates per-recipient key management from message-level encryption, enabling efficient multi-recipient messaging while maintaining per-recipient key isolation. The split password derivation means a compromised server holds neither the keys to decrypt stored messages nor the user's password.

Secria uses NIST-standardized primitives and turns post-quantum protection on by default. The apps contain no analytics or advertising libraries.

14. References#

  1. FIPS 203. Module-Lattice-Based Key-Encapsulation Mechanism Standard. NIST, August 2024.
  2. RFC 7748. Elliptic Curves for Security. A. Langley, M. Hamburg, S. Turner, January 2016.
  3. RFC 5869. HMAC-based Extract-and-Expand Key Derivation Function (HKDF). H. Krawczyk, P. Eronen, May 2010.
  4. RFC 9106. Argon2 Memory-Hard Function for Password Hashing and Proof-of-Work Applications. A. Biryukov, D. Dinu, D. Khovratovich, S. Josefsson, September 2021.
  5. NIST SP 800-38D. Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC. M. Dworkin, November 2007.
  6. FIPS 180-4. Secure Hash Standard (SHS). NIST, August 2015.
  7. RFC 6238. TOTP: Time-Based One-Time Password Algorithm. D. M'Raihi, S. Machani, M. Pei, J. Rydell, May 2011.
  8. BIP39. Mnemonic code for generating deterministic keys. M. Palatinus, P. Rusnak, A. Voisine, S. Bowe, 2013.
  9. @noble/curves, @noble/hashes. JavaScript cryptographic libraries. P. Miller (paulmillr).
  10. mlkem. JavaScript implementation of ML-KEM (FIPS 203).
  11. Cure53. Security reviews of @noble/hashes (January 2022) and @noble/curves (September 2024), published in each library's repository.
  12. draft-ietf-tls-hybrid-design. Hybrid key exchange in TLS 1.3. D. Stebila, S. Fluhrer, S. Gueron, IETF Internet-Draft.

This document describes the Secria protocol as implemented.

For security inquiries, contact: hq@secria.me

Try Secria Mail free.

Free to start. No card needed.

Love it, or get every cent back. 30 days.