skip to content

WireGuard

Fixed modern cryptography and no negotiation at all: a Noise handshake, peers identified by public key, routing decided by which key owns which addresses. Interviewers contrast it with IPsec.

on this pageshow

questions

6

In WireGuard, what identifies a peer, and why do two WireGuard peers never negotiate a cipher suite?

level: juniorimportance: must knowfreq 42%

answer

  1. a key, not a name
  2. 32 bytes, copied out of band
  3. one suite for every peer
  4. no offer to downgrade
  5. a broken primitive means updating everyone

basics

~20 s

A 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 s

Each 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

for a junior

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.

for a middle

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.

for a senior

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.

for a principal

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.
open as a page

In WireGuard, what is cryptokey routing, and how does one peer's allowed-IPs list govern both outgoing and incoming packets?

level: middleimportance: must knowfreq 36%

basics

~20 s

Cryptokey routing binds each peer's public key to its allowed IPs. Outbound, a packet's destination picks the peer whose session encrypts it. Inbound, the decrypted packet's source must map back to the peer that sent it, or the packet is dropped.

open as a page

Why is an idle WireGuard tunnel completely silent, and what do its passive keepalive and optional persistent keepalive each do?

level: middleimportance: should knowfreq 24%

basics

~20 s

WireGuard sends nothing without data to carry. The passive keepalive answers received data with an empty authenticated packet after 10 idle seconds; the optional persistent keepalive sends one periodically to hold NAT or firewall state open.

open as a page

After moving 50 engineers onto a WireGuard gateway, two laptops both complete handshakes but only one passes traffic; what in cryptokey routing explains it?

level: seniorimportance: should knowfreq 22%

basics

~20 s

The two laptops' gateway entries share one tunnel address. Handshakes check only keys, so both succeed, but each address maps to one peer. Replies go to that owner, and the other laptop's packets fail the inbound source check.

open as a page

When a WireGuard gateway replaces IPsec remote access for 50 engineers, what does the protocol leave you to build, and when would you decline?

level: principalimportance: should knowfreq 18%

basics

~20 s

WireGuard authenticates device keys, not users, and pushes no configuration, so enrolment, key-to-person mapping, revocation, addressing and client settings are yours. Decline, or keep IPsec beside it, where policy demands certificate or EAP login or mandated algorithms.

open as a page

In WireGuard's Noise IKpsk2 handshake, what does each of the two messages carry, and how does one round trip authenticate both peers?

level: middleimportance: nice to knowfreq 15%

basics

~20 s

The initiator, already holding the responder's static key, sends an ephemeral key, its encrypted static key and an encrypted timestamp. The responder answers with its own ephemeral key. Chaining four Diffie-Hellman results proves both static keys in one round trip.

open as a page