This document provides a rigorous technical definition of the Fastcomcorp ZINA protocols (spanning v1, v2, and v3), detailing the mathematical formulas, cipher specifications, and state machine logic. This guide is intended for cryptographic auditors and developers implementing compatible engines.
Fastcomcorp ZINA utilizes a cipher suite designed for post-quantum resistance and high-assurance security, with capabilities varying by protocol version.
| Primitive | Algorithm | Parameters / Specification |
|---|---|---|
| Asymmetric (Classical) | X448 | RFC 7748, 448-bit Curve, ~224-bit security |
| Asymmetric (PQ) | ML-KEM-768 | FIPS 203, Module-Lattice-Based KEM |
| Symmetric (AEAD) | AES-256-GCM | NIST SP 800-38D, 12-byte Nonce, 16-byte Tag |
| KDF | HKDF-SHA-512 | RFC 5869 with HMAC-SHA-512 |
| Signatures (Classical) | Ed448 (EdDSA) | RFC 8032, Edwards-curve Digital Signature Algorithm |
| Signatures (PQ) | Falcon-512 | FIPS 204, Lattice-based, compact |
| Authentication Hash | SHA-512 | FIPS 180-4, used for manual/automated binding |
The session initiation protocol, known as Hybrid PQ-Handshake, combines five X448 Diffie-Hellman operations with an ML-KEM encapsulation to ensure both classical forward secrecy and quantum resistance.
-
$IK_A, EK_A$ : Alice's Identity and Ephemeral key pairs. -
$IK_B, SPK_B, OPK_B, KEM_PK_B$ : Bob's public keys. -
$X448(priv, pub)$ : Curve448 scalar multiplication. -
$HKDF(salt, ikm, info, L)$ : HKDF-SHA-512 extraction and expansion.
When Alice (initiator) contacts Bob (responder), she computes:
Alice then performs the PQ encapsulation: $$ (KEM_CT, KEM_SS) = ML\text{-}KEM.Encaps(KEM_PK_B) $$
The Master Secret (
The Double Ratchet advances the Root Key (
Every ratchet response (
Note
The
For every message
Messages are encrypted using AES-256-GCM with Associated Authenticated Data (AAD) that binds the ciphertext to the protocol state.
$$ AAD = n \parallel PK_{ratchet448} \parallel session_context $$ Where:
-
$n$ : Message sequence number (4-byte little-endian). -
$PK_{ratchet448}$ : The sender's current 56-byte X448 ratchet public key. -
$session_context$ : The 32-byte session-unique identifier (derived during handshake).
To prevent Active Middleperson attacks on the ratchet exchange, every new ratchet key is signed using the sender's identity key.
In ZINA v3 "PQ-Hybrid", ratchet keys are signed via Ed448 EdDSA signatures: $$ Sig_{448} = EdDSA\text{-}448(IK_{priv}, PK_{ratchet448} \parallel n \parallel epoch) $$ This provides 114 bytes of non-malleable, high-security authentication for the asymmetric step.
Future versions and high-security profiles utilize Falcon-512 for quantum-resistant signatures: $$ Sig_{PQ} = Falcon\text{-}512.Sign(IK_{PQ,priv}, PK_{ratchet448} \parallel n \parallel epoch) $$ The protocol supports both signatures simultaneously for maximum robustness.
Group metadata is protected by an inner encryption layer derived from the pairwise session.
To hide the social graph from messaging relays, v3 "PQ-Hybrid" sessions encrypt the routing headers:
-
Header Key Derivation:
$K_{header} = HKDF(None, session_context, \text{"HeaderObfuscation"}, 32)$ -
Obfuscation:
$EncHeader = AES\text{-}256\text{-}GCM.Encrypt(K_{header}, Nonce, RoutingHeader, \text{"HeaderObfuscationV3"})$ -
Redaction: Plaintext fields in the
MessageEnvelope(sender name, device ID, message ID) are cleared after encryption.
-
Forward Secrecy: Immediate upon deletion of
$MK_j$ ; perfect at epoch boundary. -
Quantum Resistance:
$2^{128}$ symmetric equivalent for ML-KEM-768. - Metadata Silence: Transport relays see only encrypted blobs and random-looking hashes.
-
Memory Safety: Mandatory zeroization of keys and staged message keys (via
Zeroizetrait) prevents remanence.
ZINA secures bulk data (attachments) by decoupling the encryption of the file from the ratcheted message channel.
For a file
The resulting
The metadata and keys are encapsulated in a JSON descriptor
{
"url": "https://storage.zina.im/...",
"key": "base64(K_file)",
"nonce": "base64(N_file)",
"hash": "sha256(C_file)",
"name": "document.pdf",
"size": 102400
}This descriptor
-
Out-of-Band Integrity: The
hashin the descriptor allows the receiver to verify$C_{file}$ before attempting decryption with$K_{file}$ . -
PQ-Resistant Handover: By sending
$D$ through a v3 PQ-Hybrid session, the file keys inherit the same quantum resistance as the text conversation.