In WireGuard, what identifies a peer, and why do two WireGuard peers never negotiate a cipher suite?
answer
- a key, not a name
- 32 bytes, copied out of band
- one suite for every peer
- no offer to downgrade
- a broken primitive means updating everyone
basics
~20 sA WireGuard peer is identified only by its static Curve25519 public key, exchanged out of band. The cryptography is fixed by the protocol (Curve25519, ChaCha20-Poly1305, BLAKE2s), so there is nothing to negotiate and nothing to downgrade.
solid answer
~40 sEach WireGuard peer has a static Curve25519 key pair, and its 32-byte public key (44 characters in Base64) *is* its identity. There are no usernames and no certificates: the operator copies public keys between peers by any out-of-band means, much as SSH users install each other's public keys. The cryptography is fixed by the protocol: the handshake is `Noise_IKpsk2_25519_ChaChaPoly_BLAKE2s`, with Curve25519 for Diffie-Hellman, ChaCha20-Poly1305 for the packets and BLAKE2s for hashing. So the two ends never offer or choose algorithms. The WireGuard paper calls this being *cryptographically opinionated*: there is no proposal list to misconfigure and no weaker option an attacker can steer the peers toward. The price is that a broken primitive has no fallback. The paper says every endpoint would then have to be updated.
go deeper
Recall that a WireGuard peer is just a public key copied to the other end, and that the protocol uses one fixed set of algorithms with nothing negotiated.
Name the suite from the construction string, explain why fixed algorithms remove the downgrade and proposal-mismatch failures, and separate fixed algorithms from per-session keys.
Explain what an operator inherits: key distribution outside the protocol, one key pair per device, and a fleet-wide update if a primitive ever falls.
Weigh the lack of cipher agility against compliance needs: a mandated algorithm set or a long upgrade cycle on some endpoints can rule WireGuard out.
## What a WireGuard peer is **WireGuard** is a layer-3 VPN tunnel that carries IP packets inside UDP. It has no RFC. Its specification is a paper by its author (the *WireGuard whitepaper*), so every rule below is the paper's. In WireGuard a **peer** is the other end of a tunnel, and it is identified **strictly by its public key**: a 32-byte **Curve25519** point. Every interface holds one private key and a list of peers. Each peer entry is that peer's public key, the addresses it may use (its **allowed IPs**) and, optionally, the outer IP address and UDP port where it can be reached. So none of these identifies a peer: - **not an IP address**: the outer address is learned and may change as the peer roams, and the inner addresses are a filter attached to the key; - **not a username or password**: the protocol has no user concept at all; - **not a certificate**: there is no X.509 parsing, no certificate authority and no chain validation inside WireGuard. ## Where the keys come from The paper takes its key-distribution model from SSH. Two peers exchange static public keys by **some unspecified, out-of-band mechanism**: a ticket, a signed email or a provisioning system. After that they can talk. A public key is short (44 characters in Base64), so it is easy to paste. WireGuard deliberately treats key distribution as the wrong layer to solve. Whatever system you use to hand out and withdraw keys sits outside the protocol. One rule follows from the identity model. **Every device gets its own key pair.** The paper warns that two distinct peers should not share private keys, and a shared key would make two machines indistinguishable to everyone else. ## One fixed cryptographic suite The whole protocol uses one set of primitives, named in the handshake's construction string `Noise_IKpsk2_25519_ChaChaPoly_BLAKE2s`: | Job | Primitive (per the paper) | |---|---| | Handshake pattern | Noise `IK`, with the optional pre-shared key mixed in by the `psk2` modifier | | Key agreement | Curve25519 Diffie-Hellman | | Key derivation | HKDF built on BLAKE2s | | Packet encryption and integrity | ChaCha20-Poly1305 authenticated encryption | | Hashing and MACs | BLAKE2s | | Cookie encryption under load | XChaCha20-Poly1305 | No field in any WireGuard message lists algorithms, and no configuration knob selects one. Two correctly configured peers always use the same suite, because there is only one. ## Why no negotiation is a feature The paper calls WireGuard **cryptographically opinionated**: it *intentionally lacks cipher and protocol agility*. The reasons: - **No downgrade surface.** A protocol that negotiates can be pushed toward the weakest option both sides still accept. With nothing offered, there is nothing to strip. - **No proposal mismatch.** A negotiating protocol such as IKEv2 has to agree a proposal before anything works, and a mismatch between two ends is a common deployment failure. WireGuard cannot have that failure. - **A smaller protocol.** The paper argues that cipher agility *increases complexity monumentally*, and it puts its own implementation at under 4,000 lines of code. - **A one-round-trip handshake.** With no algorithms to agree, the first message can already carry the initiator's encrypted identity. ## What it costs Fixed cryptography is a trade, and an operator should be able to say what was given up: 1. **No fallback.** If a hole is found in one of the primitives, the paper says *all endpoints will be required to update*. You cannot switch a running fleet to another cipher by configuration. 2. **No algorithm policy.** A deployment that must use a specific approved algorithm set cannot ask WireGuard for it. 3. **Keys are your system.** Because identity is a bare public key, issuing, recording and withdrawing keys is the operator's job. ## A common misreading "Fixed" describes the **algorithms**, not the **keys**. Each handshake creates fresh ephemeral keys, and the paper has a new session created roughly every `Rekey-After-Time` (120 seconds). The static identity keys stay the same until the operator replaces them. The session keys keep changing, and that is where WireGuard's forward secrecy comes from.
- What goes wrong if two WireGuard laptops are given the same key pair?The other end cannot tell them apart. To the gateway they are one peer with one endpoint and one allowed-IPs list, so whichever laptop sent the latest authenticated packet takes over the endpoint and the other loses its replies. Removing the key cuts off both laptops. The WireGuard paper warns that distinct peers should not share private keys. Generate one key pair per device.
- If WireGuard's cryptography never changes, do its session keys stay the same too?No. Only the algorithms and the static identity keys are fixed. Every handshake uses fresh ephemeral Curve25519 keys and derives new symmetric keys, and per the paper a new session is created roughly every `Rekey-After-Time` (120 seconds). Old session keys are zeroed, and that is what gives WireGuard forward secrecy.
saying these in an interview costs you the question
- WireGuard authenticates users with a username and password at connect time.
- WireGuard peers agree on a cipher during the handshake, the way TLS does.
- A WireGuard peer is identified by its IP address.
- Fixed cryptography means WireGuard's session keys never change.
- If ChaCha20 were broken, an operator could switch WireGuard to AES by configuration.