Definition
Cryptographic agility is the ability of a protocol, data format or system to replace one cryptographic algorithm §14.1, key size or parameter set with another without being redesigned. It rests on three parts: an identifier on every key, message and stored object that names its algorithm; a policy listing the allowed identifiers; and a way for the parties to agree on one. RFC 7696 gives the IETF’s guidelines for algorithm agility [343]. Because agility offers a choice, an attacker may force the weaker option, a downgrade, unless the agreement is protected.
The idea
Cryptographic algorithms wear out. The 56-bit key of DES (Data Encryption Standard) was found by exhaustive search on special-purpose hardware in 1998 [344]. The first collision for SHA-1 (Secure Hash Algorithm 1), two different files with the same hash value, was published in 2017 [312]. A large quantum computer would break the public-key algorithms in common use today, and NIST published its first post-quantum standards, FIPS 203 [347], 204 [346] and 205 [345], in August 2024. A device in service for 15 years will probably need to change an algorithm. If the algorithm is fixed in the message format and in every peer, changing it means replacing every part of the system at once.
Agility adds a label and a choice. Each message says which algorithm produced it, so old and new can coexist during a transition, and peers can agree on the best algorithm both support. The choice opens an attack: in a downgrade attack §1.27, an attacker between the parties alters the negotiation so that they settle on a weaker option than both support. Agility is therefore safe only with two protections: authentication §1.6 of the negotiation, and a floor below which each party refuses to go whatever the other side says.
How it works
Identifiers. Every algorithm, together with its parameters, gets a fixed identifier. In TLS (Transport Layer Security) 1.3, a cipher suite, a named combination of algorithms, is identified by 2 bytes; for example 0x1301 names TLS_AES_128_GCM_SHA256. An identifier stands for a complete contract: key length, tag length, and the rules for the nonce §5.18, a value that must never repeat under one key. A key is bound to one algorithm and used with no other, because using one key in two algorithms can let a weakness in one break the other; this is key separation §5.23.
Negotiation.
The initiator sends the list of identifiers it supports, in order of preference.
The responder picks the first identifier on that list that it also supports and that its own policy allows, and announces its choice.
Both derive keys and continue with the chosen algorithms.
Both authenticate the negotiation. Each party computes a hash over every handshake message exactly as it sent or received it, called the transcript hash §19.1.6, and sends a MAC (message authentication code §5.7) over that hash, using a key from the new session. Each checks the other’s MAC. If an attacker changed any byte of the negotiation, the two transcripts differ, the MACs do not match, and both parties abandon the connection. In TLS 1.3 these MACs are the
Finishedmessages, and the server also signs the transcript hash with its long-term key.
The floor. Step 4 has a gap: it uses the negotiated algorithms to protect the negotiation. If the attacker can force an algorithm so weak that it can be broken while the handshake is still running, the attacker can also compute the MACs of step 4. The Logjam attack of 2015 [348] worked this way: it pushed connections to 512-bit export-grade Diffie–Hellman key agreement §19.1.4, deliberately weakened under old export rules, solved that small problem within the time the handshake allowed, and forged the final messages. Each party must therefore enforce a local minimum: never offer, never accept, and never fall back to an algorithm below the floor. An algorithm that is broken must be removed from the allowed list, not merely ranked last.
Versions. Protocol versions need the same protection. Clients that retried a failed connection with an older version let an attacker force that version by making the first attempt fail; in 2014 an attack used this to force SSL 3.0 (Secure Sockets Layer version 3.0) [349]. RFC 7507 added a signal, TLS_FALLBACK_SCSV, that a client puts in a retried handshake so that a server supporting a newer version refuses it [350]. A TLS 1.3 server that negotiates an older version ends its random value, which its signature covers, with the ASCII text DOWNGRD and one more byte, so a TLS 1.3 client detects the downgrade.
Transitions. A transition runs in stages: deploy support for the new algorithm everywhere, make it preferred, stop accepting the old one, and remove the old code. Between the first and third stages both are accepted, a deliberate exposure that needs an end date. Objects made under the old algorithm, such as signatures, encrypted files and keys, must stay readable, be protected again, or be declared invalid from a stated date.
Messages without negotiation. Where nothing is negotiated live, for example in a signed update file, the algorithm identifier and every parameter, such as the tag length, must lie inside the authenticated bytes, and the receiver checks the identifier against its own allowed list. An attacker who could change an unauthenticated tag-length field from 16 bytes to 1 byte would turn a forgery from hopeless into a 1-in-256 guess.
Worked example
Two suites are defined: suite A, identifier 0x0001, with an 8-byte tag, and suite B, identifier 0x0002, with a 16-byte tag. An offer is encoded as one count byte followed by the 2-byte identifiers.
What the weaker suite costs. A forger who submits random tags is accepted with probability per attempt under A and under B, since 8 bytes are 64 bits and 16 bytes are 128 bits. Over attempts, about a billion, the probability of at least one success is at most under A, and at most under B.
The downgrade. The client prefers B and sends the offer bytes 02 0002 0001: two suites, B then A. The attacker deletes B, and the server receives 01 0001. The server supports both suites but sees only A, so it picks A. Without protection of the negotiation, the connection runs with 8-byte tags although both sides support 16-byte tags.
The detection. The client’s transcript contains 02 0002 0001; the server’s contains 01 0001. If each transcript held only these bytes, their SHA-256 §5.2 (Secure Hash Algorithm with a 256-bit output) hashes would begin with 1837dcd2 and 85f90dfe. Each side’s final MAC covers its own hash, so each side rejects the other’s MAC, and the connection fails instead of running with suite A. A client whose policy sets B as the floor refuses A even earlier, as soon as the server announces it.
Stated precisely
Let and be the sets of suites that the client’s and the server’s policies allow. Negotiation is safe when two properties hold.
Policy: the suite that a party uses satisfies , so neither party ever runs a suite outside its own policy.
Downgrade resilience: the connection either uses the suite that the two parties would have chosen with no attacker present, or it does not complete.
The first property is enforced locally by each party and holds against any attacker. The second holds when the whole transcript is authenticated and the attacker cannot break any suite in within the duration of a handshake. When that assumption fails for some suite, the remedy is to remove the suite from the policy sets.
For stored and one-way messages, the contract is simpler: every protected object carries its algorithm identifier inside the authenticated bytes, and a receiver accepts the object only if is in its own policy set.
Limits and common mistakes
Agility is not security. Every added algorithm is more code to get wrong, to test and to maintain, and a system is only as strong as the weakest algorithm it still accepts.
An algorithm identifier outside the authenticated bytes lets an attacker change it, so that the receiver reads valid bytes under the wrong algorithm or the wrong parameters.
Authenticating the negotiation with the negotiated algorithms protects it only if every allowed algorithm resists attack for the length of the handshake. The local floor is the defense that does not depend on this.
Changing an algorithm does not protect what it already protected. An attacker who recorded traffic encrypted with a weak algorithm can still break it later, which is why post-quantum key agreement is urgent for data that must stay secret for many years.
A floor kept in state that can be rolled back is not a floor. If the minimum version or algorithm is stored where a reset or a recovery procedure restores an older value, the downgrade becomes possible again.
Questions answered
How is algorithm negotiation protected against downgrade?
Algorithm negotiation is protected against downgrade by two measures that work together: each party enforces its own minimum policy, and both parties authenticate the complete negotiation after it ends. A downgrade attack is an attacker’s change to the negotiation messages, such as deleting the strongest options from an offered list, so that the parties settle on a weaker algorithm than both support.
Local floor: each party refuses every algorithm outside its own allowed list, whatever the peer offers. This holds against every attacker.
Transcript authentication: after the handshake, each party hashes all handshake messages exactly as it sent and received them, and sends a message authentication code (MAC) or a signature over that hash. If the attacker changed any byte, the two hashes differ, the check fails, and the connection is abandoned. TLS (Transport Layer Security) 1.3 does this with its
Finishedmessages and the server’s signature, and adds markers that reveal a forced fallback to an older protocol version.Authenticated identifiers: where nothing is negotiated live, the algorithm identifier and its parameters, such as the tag length, lie inside the authenticated bytes and are checked against the local list.
Transcript authentication fails if an allowed algorithm can be broken during the handshake, because the attacker can then forge the final MACs too; the Logjam attack of 2015 did this. The floor is therefore essential: broken algorithms must be removed from the allowed list, not merely placed last.
Related entries: Downgrade attack (§1.27), Domain separation (§5.22), Authentication coverage (§5.41), Key separation (§5.23), Tag truncation (§5.12). Further reading: [312, 343, 344, 345, 346, 347, 348, 349, 350].