SSH key exchange message sizes by method: what the sources give
If you are sizing a network path for SSH post-quantum hybrid key exchange, the figures that matter most are these: the X25519 public key and shared secret are each 32 bytes, the ML-KEM-768 encapsulation key is 1184 bytes and its ciphertext is 1088 bytes, and RFC 10042 Section 3 sets a total packet size limit of 35000 bytes that implementations must support. The X25519 and ML-KEM-768 figures come from RFC 7748 and RFC 9935, and the packet limit comes from RFC 10042. This table is for network engineers, platform operators and security reviewers who need to check whether a hybrid key exchange message fits within the packet sizes their path and middleboxes handle.
RFC 10042 does not give assembled message totals. It defines the message names and what each carries: the client's SSH_MSG_KEX_HYBRID_INIT (message number 30) sends C_INIT, which is the ML-KEM public key followed by the classical public key, and the server's SSH_MSG_KEX_HYBRID_REPLY (message number 31) sends the host key, the reply string and the exchange hash signature. The RFC also states that the server checks the length of C_INIT against the expected length of each public key, and that it defines no new behavior when a hybrid message exceeds the minimum supported packet length. To get a full message size for each method, add the component sizes yourself using the values above, and confirm the host key and signature sizes for the key types you run. Also confirm the packet behavior of your SSH implementation and version against RFC 10042 Section 3 before relying on the 35000-byte limit in a path design.
Component sizes for each RFC 10042 hybrid method in bytes
This table lists the three hybrid methods defined in RFC 10042 and the component sizes the sources give for each, with the ML-KEM public key and ciphertext, the classical public key or shared secret, and the packet limit. RFC 10042 does not publish total message sizes, so the rows show the ML-KEM sizes from RFC 9935 and the classical sizes from RFC 7748 and RFC 10042, with gaps marked where the sources are silent. Check the packet limit against the sum of your chosen components before you size a network path.
| Method | ML-KEM public key and ciphertext (bytes) | Classical public key or shared secret (bytes) | Packet limit (bytes) |
|---|---|---|---|
| mlkem768nistp256-sha256 (P-256 with ML-KEM-768, SHA-256) | Public key 1184, ciphertext 1088 (RFC 9935) | Shared secret K_CL 32 (RFC 10042); P-256 public key not published in the sources | Uncompressed payload 32768 or less, total packet 35000 or less (RFC 10042, Section 3) |
| mlkem1024nistp384-sha384 (P-384 with ML-KEM-1024, SHA-384) | Public key 1568, ciphertext 1568 (RFC 9935) | Shared secret K_CL 48 (RFC 10042); P-384 public key not published in the sources | Uncompressed payload 32768 or less, total packet 35000 or less (RFC 10042, Section 3) |
| mlkem768x25519-sha256 (X25519 with ML-KEM-768, SHA-256) | Public key 1184, ciphertext 1088 (RFC 9935) | X25519 public key 32 and shared secret K_CL 32 (RFC 10042, RFC 7748) | Uncompressed payload 32768 or less, total packet 35000 or less (RFC 10042, Section 3) |
| Combined C_INIT (client to server) | Not published in the sources as a total; RFC 10042 says the server checks that its length equals the sum of the expected public key lengths | Included in the C_INIT sum above | Confirm the total against the 35000 byte limit |
| Combined S_REPLY (server to client) | Not published in the sources as a total; S_REPLY is the ciphertext followed by the classical public key | Included in the S_REPLY sum above | Also subject to the 35000 byte limit; the sources give no size for K_S or the signature |
| Packets over the limit | RFC 10042 defines no new behavior for a hybrid message that exceeds the minimum supported length | Not applicable | Confirm your implementation's handling with its vendor documentation |
How to read the message and component columns
Each SSH hybrid key exchange message is built from parts, so its length is the sum of the parts. In SSH_MSG_KEX_HYBRID_INIT (message number 30), the client sends the string C_INIT, which is C_PK2 followed by C_PK1. C_PK2 is the ML-KEM public key and C_PK1 is the classical public key. In SSH_MSG_KEX_HYBRID_REPLY (message number 31), the server sends K_S, S_REPLY and the signature on the exchange hash. S_REPLY is S_CT2 followed by S_PK1, the ML-KEM ciphertext followed by the classical public key. To size a message, add the length of each named component in the order the RFC gives. The message column on this page is the total, and the component columns show each piece, so a reader can check any total by adding its parts.
The component columns come from two sources. The classical public key lengths and the classical shared secret lengths come from RFC 10042, which defines the three method names used on this page: mlkem768nistp256-sha256, mlkem1024nistp384-sha384 and mlkem768x25519-sha256. RFC 10042 does not give byte sizes for the public keys, ciphertexts or total messages, and it states that the server checks that the length of C_INIT is the sum of the expected length of each public key. The ML-KEM key and ciphertext sizes come from RFC 9935 Appendix B Table 1, which lists encapsulation keys, decapsulation keys, ciphertexts and a 32-byte shared secret for ML-KEM-512, ML-KEM-768 and ML-KEM-1024. Those RFC 9935 sizes are for ML-KEM alone. They do not include the classical public key or the classical shared secret, and they do not include any SSH framing, so the message totals must be assembled from both sources.
Before relying on a total, confirm it against the implementation you run. The RFC 10042 requirement that implementations support a packet with an uncompressed payload of 32768 bytes or less and a total packet size of 35000 bytes or less is the reference limit for checking whether a hybrid message fits, and RFC 10042 says some post-quantum key exchanges could produce large messages and defines no new behavior when a hybrid message exceeds the minimum supported length. Check the SSH server and client versions in your environment for the method names they accept and the packet limits they enforce, since the sources on this page do not state what any particular product implements.
Where SSH hybrid message sizes meet protocol limits
RFC 10042 sets minimum size limits that every implementation must support, and it says some post-quantum exchanges could produce messages that exceed them. The cards below cover the limits themselves, the case the RFC leaves undefined, and the points where operators should confirm behavior before relying on a hybrid method.
Minimum payload and packet limits
RFC 10042 Section 3 says implementations must support packets with an uncompressed payload of 32768 bytes or less and a total packet size of 35000 bytes or less. These are the floor every peer must accept, not a ceiling for the hybrid messages themselves. Compare the expected length of SSH_MSG_KEX_HYBRID_INIT and SSH_MSG_KEX_HYBRID_REPLY for your chosen method against both figures, and treat the result as the baseline for sizing your path.
Hybrid messages above the minimum
RFC 10042 says some post-quantum key exchanges could produce large messages, and that it defines no new behavior for a hybrid message that makes a packet exceed the minimum supported length. Implementers and operators should not assume a defined fallback exists. Ask your SSH implementation vendor how it handles a key exchange packet longer than the minimum, and confirm that behavior in your own test environment before deploying a method that may produce such packets.
RFC 10042 Section 3Length checks on received hybrid messages
RFC 10042 says the server checks that the length of C_INIT equals the sum of the expected length of each public key. C_INIT is the ML-KEM public key concatenated with the classical public key, so the check depends on both component sizes. Confirm that your implementation performs this check and rejects mismatched lengths, and check that the component sizes it expects match the method you have selected, since the RFC does not list the byte sizes of these keys.
Constrained devices and small buffers
The sizes in RFC 9935 show ML-KEM encapsulation keys of 800, 1184 and 1568 bytes at the three security levels, and ciphertexts of 768, 1088 and 1568 bytes. A device that allocates a fixed key exchange buffer sized for classical key exchange may need its buffer enlarged before a hybrid method can run. Ask the device vendor whether its SSH stack allocates buffers dynamically or from a fixed size, and confirm that it can hold the 32768-byte payload limit.
RFC 9935 textPath and middlebox handling
The sources listed on this page do not say how firewalls, load balancers, or other middleboxes treat SSH key exchange packets above the classical sizes, and RFC 10042 does not describe path behavior. Test the hybrid method across the actual network path, including any inspection devices, before rollout. Record whether any device drops, truncates, or rejects large key exchange packets, and report those results to the device vendor.
Figures for each parameter set and what names it
This method, defined in RFC 10042, pairs ML-KEM-768 with the P-256 curve (secp256r1) and uses SHA-256 for the exchange hash. RFC 9935 lists ML-KEM-768 at NIST level 3, with an encapsulation key of 1184 bytes, a decapsulation key of 2400 bytes, a ciphertext of 1088 bytes and a 32-byte shared secret. RFC 10042 gives the classical shared secret K_CL for secp256r1 as 32 bytes, but it does not state the byte length of the P-256 public key, so that figure should be confirmed against the implementation or the encoding in use.
- ML-KEM public key: The client's C_PK2 is the ML-KEM-768 encapsulation key, 1184 bytes according to RFC 9935, and it is the larger part of the C_INIT string sent in SSH_MSG_KEX_HYBRID_INIT (message number 30).
- ML-KEM ciphertext: The server's S_CT2 is the ML-KEM-768 ciphertext, 1088 bytes according to RFC 9935, and it forms the first part of S_REPLY in SSH_MSG_KEX_HYBRID_REPLY (message number 31).
- Classical component: The classical public key is carried alongside the ML-KEM key in both directions. RFC 10042 names secp256r1 and gives K_CL as 32 bytes, but the point encoding length is not stated in the sources.
- NIST level: RFC 9935 places ML-KEM-768 at NIST level 3, which is the level the RFC assigns to this method's post-quantum component.
- Message composition: The total C_INIT length equals the sum of the expected public key lengths, which RFC 10042 requires the server to check.
Before sizing a network path, confirm the P-256 encoding length in your SSH implementation and add it to the ML-KEM figures above to reach the total message length for this method.
This method pairs ML-KEM-1024 with the P-384 curve (secp384r1) and uses SHA-384 for the exchange hash. RFC 9935 lists ML-KEM-1024 at NIST level 5, with an encapsulation key of 1568 bytes, a decapsulation key of 3168 bytes, a ciphertext of 1568 bytes and a 32-byte shared secret. RFC 10042 gives the classical shared secret K_CL for secp384r1 as 48 bytes, which is larger than the 32-byte value used for the P-256 and X25519 methods.
- ML-KEM public key: The client's C_PK2 is the ML-KEM-1024 encapsulation key, 1568 bytes according to RFC 9935, which makes C_INIT the largest client message of the three methods on the ML-KEM side.
- ML-KEM ciphertext: The server's S_CT2 is 1568 bytes according to RFC 9935, so S_REPLY carries the ciphertext plus the classical public key in addition to the signature and host key material in SSH_MSG_KEX_HYBRID_REPLY.
- Classical shared secret: RFC 10042 gives K_CL as 48 bytes for secp384r1, a value that differs from the 32-byte secrets of the other two methods.
- NIST level: RFC 9935 assigns ML-KEM-1024 to NIST level 5, the highest level in the ML-KEM family the RFC lists.
- Hash choice: The exchange hash uses SHA-384 as defined by RFC 10042, which is part of the method identifier and should be matched exactly when configuring clients and servers.
When estimating message lengths for this method, add the P-384 public key encoding length, which RFC 10042 does not state, and check the total against the 35000-byte total packet limit in RFC 10042 Section 3.
This method pairs ML-KEM-768 with X25519 and uses SHA-256 for the exchange hash. RFC 9935 gives the ML-KEM-768 figures at NIST level 3: an encapsulation key of 1184 bytes, a ciphertext of 1088 bytes and a 32-byte shared secret. RFC 7748 states that X25519 public keys and shared secrets are each 32 bytes, so the classical component is the smallest of the three methods' classical parts.
- ML-KEM public key: The client's C_PK2 is 1184 bytes according to RFC 9935, the same ML-KEM-768 encapsulation key used by the P-256 method.
- X25519 public key: The classical public key is a 32-byte string as RFC 7748 Section 5 defines for X25519 inputs and outputs, and RFC 10042 names X25519 as the classical component.
- Shared secret: RFC 10042 gives K_CL as 32 bytes for Curve25519, and RFC 7748 confirms the 32-byte output length.
- ML-KEM ciphertext: The server's S_CT2 is 1088 bytes, sent before S_PK1 in S_REPLY of SSH_MSG_KEX_HYBRID_REPLY.
- Message arithmetic: Because the classical part is fixed at 32 bytes, the total C_INIT length for this method is 1184 bytes plus 32 bytes, which is 1216 bytes, and the server should check this sum as RFC 10042 requires.
Recheck the total against the 32768-byte uncompressed payload and 35000-byte total packet limits in RFC 10042 Section 3 for your transport.
How to check SSH hybrid message sizes on your path
This sequence tells you which hybrid SSH key exchange method your server offers, what the key exchange messages will weigh, and whether they fit the limits in RFC 10042 Section 3. It ends with a measured result you can check against the standard, or a written request to your vendor if you cannot measure it yourself.
Confirm which hybrid method the server offers
Ask the server which key exchange methods it accepts, using the SSH client's verbose output or the server's configuration file, and look for the three methods RFC 10042 defines: mlkem768nistp256-sha256, mlkem1024nistp384-sha384 and mlkem768x25519-sha256. Record each method the server lists, because the message sizes differ between them. You are done when you have a written list of the hybrid methods on the server, or a note that none are offered. Confirm the list against the server's own documentation, since the RFC only defines the methods and does not say which products support them.
Compute the C_INIT length for each method
For each method on your list, add the length of the ML-KEM public key to the length of the classical public key, since C_INIT is C_PK2 concatenated with C_PK1. The RFC does not give byte sizes for these keys, so take the ML-KEM encapsulation key length from the NIST parameter table in RFC 9935 (800, 1184 or 1568 bytes for ML-KEM-512, 768 or 1024) and the classical key length from the curve in use (32 bytes for X25519, and the uncompressed or compressed encoding length for the P-256 and P-384 curves as your implementation documents it). Write the total for each method. You are done when every method on your list has a single C_INIT figure with its components named beside it.
Compute the S_REPLY length for each method
For each method, add the ML-KEM ciphertext length to the classical public key length, since S_REPLY is S_CT2 concatenated with S_PK1. The ciphertext lengths are 768, 1088 and 1568 bytes for ML-KEM-512, 768 and 1024 as listed in RFC 9935, and the classical public key length follows the same curve rule as in the previous step. Then note that the server's SSH_MSG_KEX_HYBRID_REPLY also carries the host key K_S and the signature on the exchange hash, so these lengths are not the full message. Add the host key and signature sizes for your certificate type, and confirm those sizes against your host key algorithm's specification. You are done when you have an S_REPLY figure and a note of what remains to be added.
Compare totals against the RFC 10042 limits
Take the largest C_INIT and the largest full server reply you computed, and compare them with the limits in RFC 10042 Section 3: an uncompressed payload length of 32768 bytes or less and a total packet size of 35000 bytes or less. Note that the RFC says implementations must support packets up to these limits and that it defines no new behavior for a hybrid message that exceeds the minimum supported length, so a message near or above the limits needs a closer look at the implementation. A message is within the limit only when both the payload and the packet total are under their respective figures. You are done when each method has a recorded pass or flag against both limits.
Test with the actual implementation
Run a real key exchange between the client and server you operate, using the method you want to measure, and capture the packets with a network analyzer or the SSH implementation's debug logging. Record the length of SSH_MSG_KEX_HYBRID_INIT and SSH_MSG_KEX_HYBRID_REPLY as sent on the wire, and compare them with your computed figures. Differences usually come from fields you did not add, such as packet headers, padding or the certificate type, so record each one. You are done when you have measured lengths for each method and an explanation for any gap between measured and computed values.
Ask the vendor for its measured message lengths
If you cannot test a method yourself, or if your server belongs to a vendor, ask the vendor in writing for the measured lengths of SSH_MSG_KEX_HYBRID_INIT and SSH_MSG_KEX_HYBRID_REPLY for each hybrid method it supports, along with the host key and signature types used in those measurements. Ask whether the vendor has tested the messages against the RFC 10042 Section 3 limits, and which version the figures apply to. Keep the answer with your computed figures so the two can be reviewed together. You are done when you hold a dated vendor reply that states the measured lengths, or a written statement that the vendor has not published them.
What these figures do not tell you
The figures on this page are not the byte totals of an SSH key exchange. RFC 10042 gives no byte sizes for the public keys, ciphertexts or complete SSH_MSG_KEX_HYBRID_INIT and SSH_MSG_KEX_HYBRID_REPLY messages. The lengths shown here are assembled from the component sizes in RFC 9935, RFC 9881, RFC 9909, RFC 7748 and RFC 8032, and they stop there. A reader sizing a network path should confirm the full message length in RFC 10042 and in the documentation of the SSH implementation they run, because the SSH packet also carries a header, padding and any message fields that the component tables do not include.
The component sizes are raw. The RFC 9881 public and private key lengths exclude ASN.1 encoding overhead, so a key serialized in a certificate, a key file or a transport field will be longer than the figure shown. The same applies to the SLH-DSA sizes from RFC 9909. The figures also describe the component algorithms, not a tested SSH product. Nothing on this page shows that a particular server or client implements these methods, which versions include them, or how they behave under real traffic. Confirm support, and the exact method names negotiated, against the release notes of the software you operate.
The size of a reply also depends on how the server encodes S_REPLY, which RFC 10042 defines as the ML-KEM ciphertext followed by the classical public key, and on how the implementation frames K_S and the signature on the exchange hash. Two servers using the same method can therefore produce different message lengths. RFC 10042 states that some post-quantum key exchanges could produce large messages and defines no new behavior when a hybrid message exceeds the minimum supported packet length. Use RFC 10042 and your implementation's documentation to confirm the encoding, and measure the real handshake on a test path before setting packet, middlebox or bandwidth limits.
SSH key exchange message size questions answered
How big is a hybrid SSH key exchange message?
The sources on this page do not give a total byte count for a hybrid SSH key exchange message. RFC 10042 defines the message structure, but it gives no byte sizes for the combined messages. The size is the sum of its parts: in SSH_MSG_KEX_HYBRID_INIT (message number 30), the client sends C_INIT, which is the ML-KEM public key followed by the classical public key. In SSH_MSG_KEX_HYBRID_REPLY (message number 31), the server sends K_S, S_REPLY and a signature on the exchange hash. The ML-KEM public key, ciphertext and classical public key sizes come from RFC 9935 and RFC 7748, and the signature size depends on the host key algorithm. Add those values for the method you run, and confirm the result against your own captures.
Which hybrid SSH method has the largest ML-KEM component?
The mlkem1024nistp384-sha384 method has the largest ML-KEM component. It pairs P-384 with ML-KEM-1024. According to RFC 9935, ML-KEM-1024 has an encapsulation key of 1568 bytes and a ciphertext of 1568 bytes, compared with 1184 bytes for each in ML-KEM-768, which mlkem768nistp256-sha256 and mlkem768x25519-sha256 both use. The classical part also changes between methods: RFC 10042 gives a 32-byte shared secret for Curve25519 and secp256r1, and 48 bytes for secp384r1. The ML-KEM-1024 method is therefore the largest on the ML-KEM side, and you should check its total against the packet limit in RFC 10042, Section 3.
Does a hybrid SSH key exchange message fit in a 35000-byte packet?
The sources do not say whether any particular hybrid message fits. RFC 10042, Section 3, requires implementations to support a total packet size of 35000 bytes or less and an uncompressed payload of 32768 bytes or less. The RFC also states that some post-quantum key exchanges could produce large messages, and it defines no new behavior for a hybrid message that makes a packet exceed the minimum supported length. To check a given method, add the ML-KEM and classical public key sizes from the standards listed on this page, plus the host key and signature fields in the reply, and compare the total with 35000 bytes. Confirm the figures in your own environment, since the sources listed here do not give a total for any method.
How does the X25519 size compare with the other classical components?
X25519 is the smallest classical component in these methods. RFC 7748, Section 5, specifies that X25519 inputs and outputs are 32-byte strings, so its public key and shared secret are each 32 bytes. The secp256r1 classical component, used by mlkem768nistp256-sha256, produces a 32-byte shared secret, the same as X25519. The secp384r1 component, used by mlkem1024nistp384-sha384, produces a 48-byte shared secret. The public key sizes for the NIST curves are not given in the sources listed on this page, so confirm those in the relevant standard before sizing a path. The shared secret is not transmitted, so it affects the key derivation rather than the message length.
Do the sources give a total byte count for SSH key exchange messages?
No. RFC 10042 gives no byte sizes for the public keys, ciphertexts or total messages. It says that the server checks that the length of C_INIT equals the sum of the expected length of each public key, but it does not list those lengths. The individual component sizes are available from the other sources on this page: ML-KEM key and ciphertext sizes from RFC 9935, Appendix B, and X25519 sizes from RFC 7748. No source here combines them into a total for a specific method, so you will need to add the components yourself or measure the message in a test environment that uses the version you run.
Which RFC defines the hybrid SSH key exchange methods?
RFC 10042 defines them. It is an Informational document published in August 2026, titled Post-Quantum/Traditional Hybrid Key Exchange with the Module-Lattice-Based Key-Encapsulation Mechanism for Use in SSH. It defines three methods: mlkem768nistp256-sha256, mlkem1024nistp384-sha384 and mlkem768x25519-sha256. It also specifies the message numbers, SSH_MSG_KEX_HYBRID_INIT (30) and SSH_MSG_KEX_HYBRID_REPLY (31). The ML-KEM parameters it relies on are defined in RFC 9935, and read the full RFC 10042 for the exact message layout and the packet limits in its Section 3. Check the vendor documentation for your SSH implementation to confirm which methods it supports.
Message flow for SSH hybrid key exchange
The client starts the exchange with SSH_MSG_KEX_HYBRID_INIT (message number 30), which carries C_INIT. C_INIT is the ML-KEM public key (C_PK2) followed by the classical public key (C_PK1). The server answers with SSH_MSG_KEX_HYBRID_REPLY (message number 31), which carries K_S, S_REPLY and the signature on the exchange hash. S_REPLY is the ML-KEM ciphertext (S_CT2) followed by the classical public key (S_PK1). When implementing, check that the server verifies the length of C_INIT against the expected length of each public key, and confirm the byte sizes for your method in your own environment, since RFC 10042 does not publish them.
Client and server exchange for the hybrid key exchange messages 30 and 31.
How DeployOpen helps plan SSH post-quantum migration
DeployOpen approaches SSH key exchange message sizes by method as a planning and implementation exercise inside your own infrastructure. We scope which hybrid methods your servers and clients would use, build and test the configuration against your network path, and document the sizes you need to plan for. The work is delivered as a written, fixed-scope engagement.
How we scope
- We agree in writing which SSH servers, clients and key exchange methods fall inside the engagement.
- We identify which network paths and middleboxes carry SSH traffic, so the message sizes can be checked against them.
- We confirm which RFC 10042 hybrid methods your SSH software versions support before any build work starts.
How we build
- We configure the agreed hybrid key exchange methods on your test servers and clients inside your own environment.
- We measure the actual SSH_MSG_KEX_HYBRID_INIT and SSH_MSG_KEX_HYBRID_REPLY message lengths in your setup.
- We test the handshake against the packet limits in RFC 10042 Section 3 and record any path that exceeds them.
How we hand over
- You receive a written report of the measured message sizes for each method and each tested network path.
- The report lists configuration changes, the software versions tested and any unresolved fragmentation or size issues.
- We walk your operations team through the configuration so they can repeat the measurements on their own systems.
How we support
- Ongoing support is available as a retainer for upgrades, retesting after SSH software changes, and updated size measurements.
- We can rerun the size tests when you add a method, change a network path or upgrade your SSH implementation.
- Confirm the final byte sizes against RFC 10042 and your vendor's documentation for the exact versions you run.

