Station-to-Station Protocol (STS)
Study STS as a corrected authenticated key exchange protocol and its use in SSH and IKE.
Station-to-Station Protocol (STS) is a free Cryptology Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Motivation for STS
The Station-to-Station (STS) protocol (Diffie, van Oorschot, Wiener, 1992) was designed to provide authenticated key agreement without a trusted third party. Pure Diffie-Hellman key exchange is unauthenticated — a man-in-the-middle can substitute their own DH values, establishing separate sessions with each party who believe they share a key. STS combines DH with digital signatures and public key certificates to provide mutual authentication. The parties authenticate by signing the DH transcript, binding the session key to their identities. STS directly influenced the design of IKE (Internet Key Exchange for IPsec) and SSH.
STS Protocol Steps
The STS protocol proceeds as follows. Alice and Bob agree on a DH group (prime p, generator g). (1) Alice sends g^a mod p to Bob. (2) Bob sends g^b mod p, Cert_B, Sig_B{g^b, g^a} to Alice. Bob signs the concatenation of both DH values using his private key. (3) Alice verifies Bob's certificate and signature, then sends Cert_A, Sig_A{g^a, g^b} encrypted under the session key K = (g^ab mod p). Alice's identity and signature are encrypted, providing Alice's identity protection — passive eavesdroppers cannot link Alice to this session. Both parties compute K = g^ab mod p and are mutually authenticated via the signatures.
STS vs Unauthenticated DH
Comparing STS to unauthenticated DH illustrates what authentication adds. In plain DH, Mallory intercepts g^a and g^b, substitutes g^m with Alice and g^m with Bob, establishing K1 = g^am and K2 = g^bm. Mallory decrypts all traffic. In STS, Bob signs {g^b, g^a} — this signature is over the exact DH values in this session. Even if Mallory substitutes g^m for g^b, Mallory cannot forge a valid signature from Bob's certificate key. Alice rejects the session. The key insight: authentication in key exchange must cover the DH transcript, not just identity claims.
Forward Secrecy in STS
STS achieves perfect forward secrecy (PFS) because the session key is derived from ephemeral DH values (g^a, g^b) which are discarded after the session. Even if Bob's long-term signing key is later compromised, previously recorded STS sessions cannot be decrypted — the attacker needs the ephemeral DH exponents a and b, which were never stored. This is the same property valued in TLS with ECDHE cipher suites. Without ephemeral DH (e.g., using RSA key transport where the session key is encrypted under the server's static RSA key), compromise of the long-term key decrypts all past sessions.
Identity Protection
STS encrypts Alice's certificate and signature in step 3, providing responder identity protection against passive eavesdroppers. A passive observer sees only Alice's DH value and Bob's certificate (which Bob sends in plaintext in step 2). Alice's identity is hidden from passive eavesdropping. Active attackers who mount a MITM are detected by the signature verification failure. This asymmetry (initiator identity revealed to active attacker, responder identity protected from passive eavesdropper) is a deliberate design trade-off — full identity protection for both parties against active attackers requires additional protocol complexity (pre-sharing DH values or using anonymous group elements).
STS in IKEv1 and IKEv2
IKE (Internet Key Exchange), the key management protocol for IPsec, is directly derived from STS. IKEv1 (RFC 2409) implemented STS-style signature authentication in its Main Mode. IKEv2 (RFC 7296) is a cleaner redesign with four message flows: IKE_SA_INIT (DH exchange, nonces), IKE_AUTH (identity, certificate, signature over the IKE_SA_INIT transcript). The signature format is AUTH = PRF(SK_pi, transcript) for PSK or a digital signature over the IKE_SA_INIT octets for certificate authentication. IKEv2 also supports Extensible Authentication Protocol (EAP) for legacy password-based auth, analogous to STS's support for various authentication methods.
STS in SSH
SSH key authentication uses a mechanism similar to STS step 3. After the DH key exchange (SSH_MSG_KEXDH_REPLY contains the server's public key, DH value, and a signature over the exchange hash), the client verifies the server's host key. For client authentication (SSH_MSG_USERAUTH_REQUEST with method publickey), the client signs {session_id, username, service, method, key_algo, public_key} using its private key. The session_id is derived from the DH transcript, binding the authentication to this specific session — preventing the cross-session forgery that plagued NS. SSH does not use certificates by default but supports them via ssh-keygen -s (certificate signing) for large deployments.
Sigma Protocol Family
STS is a member of the SIGMA (SIGn-and-MAc) family of authenticated key exchange (AKE) protocols, formalized by Hugo Krawczyk. SIGMA adds a MAC to STS: each party signs the transcript and MACs their identity under the session key: MAC(K, identity). The MAC binds the identity to the session key, preventing a specific attack where an adversary can link signatures from different sessions. SIGMA-I (initiator identity protected), SIGMA-R (responder identity protected), and SIGMA-0 (no identity protection) are variants. IKEv2 and Signal's X3DH are SIGMA-family protocols. The SIGMA formalism provides a rigorous security proof for STS-like designs.
KCI Attack and STS Variants
STS is vulnerable to Key Compromise Impersonation (KCI): if Alice's long-term key is compromised, an attacker can impersonate any party to Alice in a new session (because the attacker can forge Alice's signature on any transcript). This means compromise of one party's key allows an adversary to impersonate others to that party. KCI is inherent in signature-based AKE protocols — defending against it requires the session key to depend on both parties' contributions in a way that prevents the compromised party from substituting. HMQV (Hashed Menezes-Qu-Vanstone) and NAXOS provide KCI resistance at the cost of additional complexity.
Deniability and Off-the-Record Messaging
STS provides non-repudiation: the signatures prove who said what, with cryptographic certainty. This is sometimes undesirable — in private conversations, participants may not want cryptographic proof of their statements to be producible in court. Off-the-Record (OTR) messaging and Signal's Double Ratchet provide deniability: instead of signing messages, they use MAC keys that are both held by sender and receiver. After the conversation, both parties can claim the other fabricated the messages, since each holds the key to produce the MACs. The trade-off: deniability sacrifices non-repudiation. STS-like designs are appropriate where accountability is required; OTR/Signal where deniability is valued.
STS Security Proof
STS security was analyzed informally in the original paper but formally proved by Bellare and Rogaway (1993, 1994) in their landmark AKE security model. They defined what it means for a key exchange protocol to be secure: indistinguishability of session keys from random, even when the adversary can register parties, reveal session keys, reveal long-term keys (except for the target session), and control the network. This simulation-based security model, extended by Canetti-Krawczyk and later UC (Universal Composability), is now standard for proving AKE protocols. TLS 1.3, Signal, and Noise all have formal proofs in variants of this model.
STS Signature Binding Quiz
Why does STS require both DH values (g^a and g^b) to be included in the signed transcript?
STS Protocol Recap
STS combines ephemeral DH key exchange with digital signatures to provide authenticated key agreement without a TTP. Both parties sign the DH transcript, binding authentication to the session. STS achieves forward secrecy (ephemeral DH), mutual authentication (signatures), and responder identity protection (Alice's data encrypted before sending). STS directly influenced IKEv2 and SSH key authentication. SIGMA formalizes STS with identity MACs and security proofs. KCI is an inherent STS weakness mitigated by HMQV/NAXOS. Deniability (as in Signal) requires replacing signatures with MACs for message-level authenticity.
Frequently asked questions
Is the “Station-to-Station Protocol (STS)” lesson free?
Yes — the full text of “Station-to-Station Protocol (STS)” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.
What will I learn in “Station-to-Station Protocol (STS)”?
Study STS as a corrected authenticated key exchange protocol and its use in SSH and IKE. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Cryptology Academy?
No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Station-to-Station Protocol (STS)” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Cryptology Academy lesson?
Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- The Needham-Schroeder Protocol and Attacks
- Station-to-Station Protocol (STS)
- The Noise Protocol Framework
- Principles of Secure Protocol Design